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

chore: upgrade rollup #1068

Merged
merged 11 commits into from
Jul 22, 2021
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@
"@babel/register": "^7.0.0",
"@blueprintjs/icons": "^3.13.0",
"@reactions/component": "^2.0.2",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/plugin-replace": "^2.3.0",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@size-limit/preset-big-lib": "^4.5.4",
"@storybook/addon-essentials": "^6.0.21",
"@storybook/addon-options": "^5.3.21",
Expand Down Expand Up @@ -131,8 +132,7 @@
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-test-renderer": "^16.5.2",
"rollup": "^1.29.1",
"rollup-plugin-babel": "^4.3.3",
"rollup": "^2.28.2",
"rollup-plugin-terser": "^5.2.0",
"sinon": "^8.1.0",
"size-limit": "^4.5.0",
Expand Down
44 changes: 16 additions & 28 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
import babel from 'rollup-plugin-babel'
import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import pkg from './package.json'
import replace from '@rollup/plugin-replace'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import pkg from './package.json'

// Use peerDependencies as rollup external
// https://rollupjs.org/guide/en/#peer-dependencies
const { peerDependencies } = pkg
const external = Object.keys(peerDependencies)

// Explicitly specify unresolvable named exports.
// https://github.com/rollup/plugins/tree/master/packages/commonjs#namedexports
const namedExports = {
'node_modules/react-is/index.js': ['isForwardRef'],
'node_modules/prop-types/index.js': [
'array',
'arrayOf',
'func',
'number',
'object',
'oneOf',
'oneOfType',
'string'
]
}
mshwery marked this conversation as resolved.
Show resolved Hide resolved

// Ignore SSR imports in UMD, replace with empty functions
const ignoreSSR = {
ssr: './ssr/index.umd.js'
Expand All @@ -48,17 +32,19 @@ export default [
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
...ignoreSSR
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('development'),
...ignoreSSR
}
}),
resolve(),
commonjs({
include: 'node_modules/**',
namedExports
include: 'node_modules/**'
}),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
babelHelpers: 'runtime'
})
]
},
Expand All @@ -78,17 +64,19 @@ export default [
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
...ignoreSSR
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify('production'),
...ignoreSSR
}
}),
resolve(),
commonjs({
include: 'node_modules/**',
namedExports
include: 'node_modules/**'
}),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
babelHelpers: 'runtime'
}),
terser()
]
Expand Down
Loading