Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sucrase/webpack-loader

alangpierce260.5kMIT2.0.0TypeScript support: included

Webpack loader for Sucrase

readme

Sucrase Webpack loader

npm version MIT License

This is a simple Webpack loader that makes it easy to use Sucrase in your build.

Note: Object rest/spread syntax (e.g. {...a, b: c}) requires Webpack 4. For earlier Webpack versions, you can use webpack-object-rest-spread-plugin alongside this loader.

Usage

First install the package and Sucrase as a dev dependency:

yarn add --dev @sucrase/webpack-loader sucrase

Then add it as a loader to your webpack config:

module: {
  rules: [
    {
      test: /\.js$/,
      use: {
        loader: '@sucrase/webpack-loader',
        options: {
          transforms: ['jsx']
        }
      }
    }
  ]
}

changelog

2.0.0 (2018-06-10)

  • Switch Sucrase peer dependency to ^3, update code to use new return type.