|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | const rollup = require('rollup'); |
4 | | -const babel = require('rollup-plugin-babel'); |
| 4 | +const babel = require('@rollup/plugin-babel').babel; |
5 | 5 | const closure = require('./plugins/closure-plugin'); |
6 | | -const commonjs = require('rollup-plugin-commonjs'); |
| 6 | +const commonjs = require('@rollup/plugin-commonjs'); |
7 | 7 | const flowRemoveTypes = require('flow-remove-types'); |
8 | 8 | const prettier = require('rollup-plugin-prettier'); |
9 | | -const replace = require('rollup-plugin-replace'); |
| 9 | +const replace = require('@rollup/plugin-replace'); |
10 | 10 | const stripBanner = require('rollup-plugin-strip-banner'); |
11 | 11 | const chalk = require('chalk'); |
12 | | -const resolve = require('rollup-plugin-node-resolve'); |
| 12 | +const resolve = require('@rollup/plugin-node-resolve'); |
13 | 13 | const fs = require('fs'); |
14 | 14 | const argv = require('minimist')(process.argv.slice(2)); |
15 | 15 | const Modules = require('./modules'); |
@@ -144,6 +144,7 @@ function getBabelConfig( |
144 | 144 | exclude: '/**/node_modules/**', |
145 | 145 | babelrc: false, |
146 | 146 | configFile: false, |
| 147 | + babelHelpers: 'bundled', |
147 | 148 | presets: [], |
148 | 149 | plugins: [...babelPlugins], |
149 | 150 | }; |
@@ -185,7 +186,8 @@ function getRollupOutputOptions( |
185 | 186 | format, |
186 | 187 | globals, |
187 | 188 | freeze: !isProduction, |
188 | | - interop: false, |
| 189 | + interop: 'auto', |
| 190 | + exports: 'auto', |
189 | 191 | name: globalName, |
190 | 192 | sourcemap: false, |
191 | 193 | esModule: false, |
@@ -366,11 +368,14 @@ function getPlugins( |
366 | 368 | }, |
367 | 369 | // Turn __DEV__ and process.env checks into constants. |
368 | 370 | replace({ |
369 | | - __DEV__: isProduction ? 'false' : 'true', |
370 | | - __PROFILE__: isProfiling || !isProduction ? 'true' : 'false', |
371 | | - __UMD__: isUMDBundle ? 'true' : 'false', |
372 | | - 'process.env.NODE_ENV': isProduction ? "'production'" : "'development'", |
373 | | - __EXPERIMENTAL__, |
| 371 | + preventAssignment: true, |
| 372 | + values: { |
| 373 | + __DEV__: isProduction ? 'false' : 'true', |
| 374 | + __PROFILE__: isProfiling || !isProduction ? 'true' : 'false', |
| 375 | + __UMD__: isUMDBundle ? 'true' : 'false', |
| 376 | + 'process.env.NODE_ENV': isProduction ? "'production'" : "'development'", |
| 377 | + __EXPERIMENTAL__, |
| 378 | + }, |
374 | 379 | }), |
375 | 380 | // The CommonJS plugin *only* exists to pull "art" into "react-art". |
376 | 381 | // I'm going to port "art" to ES modules to avoid this problem. |
@@ -550,14 +555,15 @@ async function createBundle(bundle, bundleType) { |
550 | 555 | } |
551 | 556 |
|
552 | 557 | const importSideEffects = Modules.getImportSideEffects(); |
553 | | - const pureExternalModules = Object.keys(importSideEffects).filter( |
| 558 | + const moduleSideEffects = Object.keys(importSideEffects).filter( |
554 | 559 | module => !importSideEffects[module] |
555 | 560 | ); |
556 | 561 |
|
557 | 562 | const rollupConfig = { |
| 563 | + strictDeprecations: true, |
558 | 564 | input: resolvedEntry, |
559 | 565 | treeshake: { |
560 | | - pureExternalModules, |
| 566 | + moduleSideEffects, |
561 | 567 | }, |
562 | 568 | external(id) { |
563 | 569 | const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/'); |
@@ -588,13 +594,14 @@ async function createBundle(bundle, bundleType) { |
588 | 594 | bundleType, |
589 | 595 | bundle.global, |
590 | 596 | bundle.moduleType, |
591 | | - pureExternalModules, |
| 597 | + moduleSideEffects, |
592 | 598 | bundle |
593 | 599 | ), |
594 | 600 | output: { |
595 | 601 | externalLiveBindings: false, |
596 | 602 | freeze: false, |
597 | | - interop: false, |
| 603 | + interop: 'auto', |
| 604 | + exports: 'auto', |
598 | 605 | esModule: false, |
599 | 606 | }, |
600 | 607 | }; |
|
0 commit comments