@rollup/plugin-babel#babel JavaScript Examples

The following examples show how to use @rollup/plugin-babel#babel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: rollup.config.js    From easy-toggler with MIT License 6 votes vote down vote up
configs = bundles.map(({ input: inputPath, output }) => ({
    input: inputPath,
    output,
    plugins: [
        nodeResolve(),
        babel({
            babelHelpers: 'bundled',
            plugins: ['annotate-pure-calls'],
        }),
        replace({
            __DEV__: false,
            preventAssignment: true,
        }),
        output.file.includes('.min.') && terser(),
    ],
}))
Example #2
Source File: rollup.config.js    From wp2vite with MIT License 6 votes vote down vote up
config = {
  treeshake: {
    moduleSideEffects: 'no-external',
    propertyReadSideEffects: false,
    tryCatchDeoptimization: false,
  },
  input: {
    index: path.resolve(__dirname, 'src/main/start.js'),
    cli: path.resolve(__dirname, 'src/main/cli.js'),
  },
  external: [
    ...Object.keys(require('./package.json').dependencies),
  ],
  output: {
    dir: path.resolve(__dirname, 'dist/'),
    entryFileNames: `[name].js`,
    chunkFileNames: 'chunks/dep-[hash].js',
    exports: 'named',
    format: 'cjs',
    externalLiveBindings: false,
    freeze: false,
  },
  plugins: [
    nodeResolve({
      preferBuiltins: true,
    }),
    babel({
      babelHelpers: 'bundled',
      exclude: "node_modules/**",
    }),
    commonjs({
      extensions: ['.js'],
      ignoreDynamicRequires: true,
    }),
    json(),
    terser(),
  ],
}
Example #3
Source File: rollup.config.js    From show-more with MIT License 6 votes vote down vote up
pluginsConfig = (target) => [
  babel({
    babelHelpers: "bundled",
    presets: [
      [
        "@babel/preset-env",
        {
          // debug: true,
          // useBuiltIns: 'usage',
          useBuiltIns: "entry",
          corejs: 3,
          loose: true,
          ...target,
        },
      ],
    ],
  }),
  cleanup(),
]
Example #4
Source File: rollup.config.js    From todomvc with MIT License 5 votes vote down vote up
config = {
  input: 'src/app.js',
  output: {
	file: 'dist/bundle.js',
    format: 'iife'
  },
  plugins: [babel({ babelHelpers: 'bundled' })]
}
Example #5
Source File: rollup.config.js    From vue-hero-icons with MIT License 5 votes vote down vote up
plugins = [babel({ babelHelpers: "bundled" })]
Example #6
Source File: rollup.config.js    From react-menu with MIT License 5 votes vote down vote up
sharedConfig = {
  external: ['react', 'react-dom', 'react/jsx-runtime', 'prop-types', 'react-transition-state'],
  plugins: [nodeResolve(), babel({ babelHelpers: 'bundled' })],
  treeshake: {
    moduleSideEffects: false,
    propertyReadSideEffects: false
  }
}
Example #7
Source File: rollup.config.js    From form-create-designer with MIT License 5 votes vote down vote up
module.exports = {
    input: join(cwd, '/src/index.js'),
    onwarn: (warning) => {
        if (typeof warning === 'string') {
            return colors.yellow('warning');
        }
        const code = (warning.code || '').toLowerCase();
        if (code === 'mixed_exports' || code === 'missing_global_name') {
            return;
        }
        let message = warning.message;
        console.log(`${colors.yellow(`${code}`)}${colors.dim(':')} ${message}`);
    },
    output: OutputOptions(),
    external:Object.keys(globals || {}).filter(
        v => !/^[\.\/]/.test(v)
    ),
    plugins: [
        vuePlugin({
            css: false
        }),
        postcss({
            minimize: true,
            extract: false,
            plugins: [
                cssUrl({
                    imgExtensions : /\.(png|jpg|jpeg|gif|svg)$/,
                    fontExtensions : /\.(ttf|woff|woff2|eot)$/,
                    limit : 8192,
                    hash : false,
                    slash : false
                }),
            ]
        }),
        externals({
            devDeps: false
        }),
        formCreateNodeResolve(),
        nodeResolve({
            extensions: ['.js', '.json', '.jsx', '.ts', '.tsx'],
            preferBuiltins: true,
            jsnext: true,
            module: true
        }),
        commonjs({
            ignore: (name) => {
                return isExternal(not_externals, name);
            }
        }),
        babel({
            babelHelpers: 'bundled',
            exclude: 'node_modules/**',
            extensions: ['.js', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
        }),
        replace({
            preventAssignment: true,
            'process.env.NODE_ENV': JSON.stringify('production'),
        }),
        buble(),
        visualizer()
    ]
};