1.0.0 • Published 1 year ago

esbuild-plugin-babel-next v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

esbuild-plugin-babel-next

This is the fork of original esbuild-plugin-babel. The main difference is that this fork supports ES modules config.

Babel plugin for esbuild.

First, check if esbuild supports the transform you need (it's faster).
If not, you can add the Babel plugin you need with this plugin.

Install

npm install esbuild-plugin-babel-next -D

Use

esbuild.config.js

import esbuild from 'esbuild';
import babel from 'esbuild-plugin-babel-next';

esbuild
    .build({
        entryPoints: ['index.js'],
        bundle: true,
        outfile: 'main.js',
        plugins: [babel()],
        // target: ['es5'] // if you target es5 with babel, add this option
    })
    .catch(() => process.exit(1));

package.json

{
    "type": "module",
    "scripts": {
        "start": "node esbuild.config.js"
    }
}

Configure

esbuild.config.js

babel({
    filter: /.*/,
    namespace: '',
    config: {} // babel config here or in babel.config.json
});

babel.config.json

{
    "sourceMaps": "inline",
    "presets": [...],
    "plugins": [...]
}

Check

esbuild-serve    Serve with live reload for esbuild.

esbuild-plugin-pipe    Pipe esbuild plugins output.

esbuild-plugin-svg    Svg files import plugin for esbuild.

esbuild-plugin-postcss-literal    PostCSS tagged template literals plugin for esbuild.

1.0.0

1 year ago