This repository was archived by the owner on Dec 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 93
Suggest Sucrase plugin #122
Copy link
Copy link
Open
Labels
Description
Awesome work you have done. May i suggest an sucrase plugin?
sucrase.io
Should be possible with the plugin to reduce packages that are installed.
babel-core installs a lot of packages. And build time should be faster.
const { transform } = require('sucrase');
module.exports = function plugin(config, options) {
return {
defaultBuildScript: "build:js,jsx,ts,tsx",
build({ contents, filePath, fileContents }) {
const result = transform(contents || fileContents,
{
transforms: ["imports", "typescript", "jsx"],
jsxPragma: options.jsxPragma,
jsxFragmentPragma: options.jsxFragmentPragma,
production: true,
filePath: filePath,
sourceMapOptions: false
});
return { result: result.code };
},
};
};imports transform is not needed when files are es6, typescript transform is not needed if project is not typescript...
Just a small question at the end: Do you accept custom templates? Is a rollup-plugin wanted?
Reactions are currently unavailable