New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

babel-plugin-sandstone-require

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-sandstone-require

Babel plugin that adds Sandstone.h import declaration if file contains JSX tags.

1.0.0
latest
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created

babel-plugin-sandstone-require

Babel plugin that adds Sandstone's h declaration if file contains JSX tags.

This code was forked from babel-plugin-preact-require. Credit where credit is due

Example

Your component.js that contains this code:

export default function Component() {
    return (
        <div />
    )
}

will be transpiled into something like this:

import { h } from 'sandstone'

export default function Component() {
  /* this part will be transpiled by babel itself as usual */
  return (
    h('div')
  )
}

Usage

  • Install babel-plugin-sandstone-require.
npm install babel-plugin-sandstone-require --save-dev
  • Add sandstone-require into .babelrc. This plugin should be defined before any module transforms plugin because it's using ES2015 modules syntax to import Sandstone's h into scope.
{
  "plugins": [
    "sandstone-require"
  ]
}

FAQs

Package last updated on 18 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts