@tongzag/rollup-plugin-bytenode
A Simple Rollup plugin compile your code use bytenode
Install
# npm
npm install --save-dev @tongzag/rollup-plugin-bytenode
# yarn
yarn add -D @tongzag/rollup-plugin-bytenode
# pnpm
pnpm add -D @tongzag/rollup-plugin-bytenode
Usage
Create a rollup.config.js
configuration file and import the plugin:
import bytenode from '@tongzag/rollup-plugin-bytenode';
export default {
input: 'src/index.js',
output: {
dir: 'output',
format: 'cjs'
},
plugins: [bytenode()]
};
ensure that this plugin is added to the
plugins
array after all
Options
compileAsModule
Type: boolean
Default: false
If true, the output will be a commonjs module.
electron
Type: boolean
Default: false
If true, the output will be a compiled through Electrong. Default: false.
includes
Type: Regexp
Default: /[^\.]+(\.jsc)\..+/
Plugin will match all files then transform to bytenode file
Caution
- Because of bytenode issue, i use
@babel/plugin-transform-arrow-functions
to compilearrow function
- Compile
bytenode file
tocommonjs
even if you determineoutput.format = 'esm'