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 #24890

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
"@babel/preset-flow": "^7.10.4",
"@babel/preset-react": "^7.10.4",
"@babel/traverse": "^7.11.0",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-replace": "^2.3.3",
"abort-controller": "^3.0.0",
"art": "0.10.1",
"babel-eslint": "^10.0.3",
Expand Down Expand Up @@ -83,13 +86,10 @@
"random-seed": "^0.3.0",
"react-lifecycles-compat": "^3.0.4",
"rimraf": "^3.0.0",
"rollup": "^1.19.4",
"rollup-plugin-babel": "^4.0.1",
"rollup-plugin-commonjs": "^9.3.4",
"rollup": "^2.28.2",
"rollup-plugin-node-resolve": "^2.1.1",
"rollup-plugin-prettier": "^0.6.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-strip-banner": "^0.2.0",
"rollup-plugin-prettier": "^2.1.0",
"rollup-plugin-strip-banner": "^2.0.0",
"semver": "^7.1.1",
"targz": "^1.0.1",
"through2": "^3.0.1",
Expand Down
36 changes: 21 additions & 15 deletions scripts/rollup/build.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

const rollup = require('rollup');
const babel = require('rollup-plugin-babel');
const babel = require('@rollup/plugin-babel').babel;
const closure = require('./plugins/closure-plugin');
const commonjs = require('rollup-plugin-commonjs');
const commonjs = require('@rollup/plugin-commonjs');
const prettier = require('rollup-plugin-prettier');
const replace = require('rollup-plugin-replace');
const replace = require('@rollup/plugin-replace');
const stripBanner = require('rollup-plugin-strip-banner');
const chalk = require('chalk');
const resolve = require('rollup-plugin-node-resolve');
Expand All @@ -20,7 +20,7 @@ const useForks = require('./plugins/use-forks-plugin');
const stripUnusedImports = require('./plugins/strip-unused-imports');
const Packaging = require('./packaging');
const {asyncRimRaf} = require('./utils');
const codeFrame = require('babel-code-frame');
const codeFrame = require('@babel/code-frame');
const Wrappers = require('./wrappers');

const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL;
Expand Down Expand Up @@ -154,6 +154,7 @@ function getBabelConfig(
exclude: '/**/node_modules/**',
babelrc: false,
configFile: false,
babelHelpers: 'bundled',
presets: [],
plugins: [...babelPlugins],
};
Expand Down Expand Up @@ -196,6 +197,7 @@ function getRollupOutputOptions(
globals,
freeze: !isProduction,
interop: false,
exports: 'auto',
name: globalName,
sourcemap: false,
esModule: false,
Expand Down Expand Up @@ -356,14 +358,17 @@ function getPlugins(
},
// Turn __DEV__ and process.env checks into constants.
replace({
__DEV__: isProduction ? 'false' : 'true',
__PROFILE__: isProfiling || !isProduction ? 'true' : 'false',
__UMD__: isUMDBundle ? 'true' : 'false',
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
__EXPERIMENTAL__,
// Enable forked reconciler.
// NOTE: I did not put much thought into how to configure this.
__VARIANT__: bundle.enableNewReconciler === true,
preventAssignment: false,
values: {
__DEV__: isProduction ? 'false' : 'true',
__PROFILE__: isProfiling || !isProduction ? 'true' : 'false',
__UMD__: isUMDBundle ? 'true' : 'false',
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
__EXPERIMENTAL__,
// Enable forked reconciler.
// NOTE: I did not put much thought into how to configure this.
__VARIANT__: bundle.enableNewReconciler === true,
},
}),
// The CommonJS plugin *only* exists to pull "art" into "react-art".
// I'm going to port "art" to ES modules to avoid this problem.
Expand Down Expand Up @@ -533,14 +538,14 @@ async function createBundle(bundle, bundleType) {
}

const importSideEffects = Modules.getImportSideEffects();
const pureExternalModules = Object.keys(importSideEffects).filter(
const moduleSideEffects = Object.keys(importSideEffects).filter(
module => !importSideEffects[module]
);

const rollupConfig = {
input: resolvedEntry,
treeshake: {
pureExternalModules,
moduleSideEffects,
},
external(id) {
const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/');
Expand Down Expand Up @@ -571,12 +576,13 @@ async function createBundle(bundle, bundleType) {
bundleType,
bundle.global,
bundle.moduleType,
pureExternalModules,
moduleSideEffects,
bundle
),
output: {
externalLiveBindings: false,
freeze: false,
exports: 'auto',
interop: false,
esModule: false,
},
Expand Down
Loading