Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rollup babel plugin #616

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 32 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"@babel/preset-env": "^7.8.7",
"@babel/preset-flow": "^7.7.4",
"@rollup/plugin-alias": "^3.0.1",
"@rollup/plugin-babel": "^5.0.0",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^6.1.0",
Expand All @@ -88,7 +89,6 @@
"module-details-from-path": "^1.0.3",
"pretty-bytes": "^5.3.0",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-bundle-size": "^1.0.1",
"rollup-plugin-es3": "^1.1.0",
"rollup-plugin-postcss": "^2.4.1",
Expand Down
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import autoprefixer from 'autoprefixer';
import cssnano from 'cssnano';
import { rollup, watch } from 'rollup';
import commonjs from '@rollup/plugin-commonjs';
import babel from 'rollup-plugin-babel';
import babel from '@rollup/plugin-babel';
import customBabel from './lib/babel-custom';
import nodeResolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
Expand Down Expand Up @@ -580,9 +580,10 @@ function createConfig(options, entry, format, writeMeta) {
// if defines is not set, we shouldn't run babel through node_modules
isTruthy(defines) &&
babel({
babelHelpers: 'bundled',
babelrc: false,
configFile: false,
compact: false,
configFile: false,
include: 'node_modules/**',
plugins: [
[
Expand All @@ -592,6 +593,7 @@ function createConfig(options, entry, format, writeMeta) {
],
}),
customBabel()({
babelHelpers: 'bundled',
extensions: EXTENSIONS,
exclude: 'node_modules/**',
passPerPreset: true, // @see https://babeljs.io/docs/en/options#passperpreset
Expand Down
4 changes: 2 additions & 2 deletions src/lib/babel-custom.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createConfigItem } from '@babel/core';
import babelPlugin from 'rollup-plugin-babel';
import { createBabelInputPluginFactory } from '@rollup/plugin-babel';
import merge from 'lodash.merge';
import transformFastRest from './transform-fast-rest';
import { isTruthy } from '../utils';
Expand Down Expand Up @@ -50,7 +50,7 @@ const createConfigItems = (type, items) => {
const presetEnvRegex = RegExp(/@babel\/(preset-)?env/);

export default () => {
return babelPlugin.custom(babelCore => {
return createBabelInputPluginFactory(babelCore => {
return {
// Passed the plugin options.
options({ custom: customOptions, ...pluginOptions }) {
Expand Down