Skip to content

Updated rollup to version 2 and also its plugins to the latest version #19918

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

Closed
wants to merge 2 commits 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
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"@babel/preset-react": "^7.10.4",
"@babel/traverse": "^7.11.0",
"@mattiasbuelens/web-streams-polyfill": "^0.3.2",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-replace": "^2.3.3",
"art": "0.10.1",
"babel-eslint": "^10.0.3",
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
Expand Down Expand Up @@ -81,13 +84,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 Expand Up @@ -134,4 +134,4 @@
"merge-fork": "node ./scripts/merge-fork/merge-fork.js",
"replace-fork": "node ./scripts/merge-fork/replace-fork.js"
}
}
}
17 changes: 10 additions & 7 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 path = require('path');
Expand All @@ -22,7 +22,7 @@ const stripUnusedImports = require('./plugins/strip-unused-imports');
const extractErrorCodes = require('../error-codes/extract-errors');
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 @@ -156,6 +156,7 @@ function getBabelConfig(
exclude: '/**/node_modules/**',
babelrc: false,
configFile: false,
babelHelpers: 'bundled',
presets: [],
plugins: [...babelPlugins],
};
Expand Down Expand Up @@ -233,6 +234,7 @@ function getRollupOutputOptions(
globals,
freeze: !isProduction,
interop: false,
exports: 'auto',
name: globalName,
sourcemap: false,
esModule: false,
Expand Down Expand Up @@ -564,14 +566,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 All @@ -591,12 +593,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
1 change: 1 addition & 0 deletions scripts/rollup/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const importSideEffects = Object.freeze({
'react/jsx-dev-runtime': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
'react-fetch/node': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
'react-dom': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
react: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
});

// Bundles exporting globals that other modules rely on.
Expand Down
Loading