Skip to content

Commit 0f0d9a0

Browse files
authored
build: update rollup config (#98)
1 parent 7e2860f commit 0f0d9a0

File tree

4 files changed

+40
-31
lines changed

4 files changed

+40
-31
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
],
2121
"ignore": [
2222
"node_modules/**"
23+
],
24+
"plugins": [
25+
"@babel/plugin-transform-runtime"
2326
]
2427
}

package-lock.json

Lines changed: 25 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"devDependencies": {
5050
"@babel/cli": "^7.10.1",
5151
"@babel/core": "^7.10.2",
52+
"@babel/plugin-transform-runtime": "^7.10.1",
5253
"@babel/preset-env": "^7.10.2",
5354
"@babel/preset-react": "^7.10.1",
5455
"@commitlint/cli": "^9.0.1",
@@ -95,8 +96,6 @@
9596
"react-test-renderer": "^16.13.1",
9697
"rollup": "^2.13.1",
9798
"rollup-plugin-filesize": "^9.0.0",
98-
"rollup-plugin-local-resolve": "^1.0.7",
99-
"rollup-plugin-peer-deps-external": "^2.2.2",
10099
"rollup-plugin-postcss": "^3.1.2",
101100
"sass": "^1.26.7",
102101
"sass-loader": "^8.0.2",
@@ -114,5 +113,8 @@
114113
"prop-types": "^15.7.2",
115114
"react": "^16.12.0",
116115
"react-dom": "^16.12.0"
116+
},
117+
"dependencies": {
118+
"@babel/runtime": "^7.10.2"
117119
}
118120
}

rollup.config.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import commonjs from '@rollup/plugin-commonjs';
44
import postcss from 'rollup-plugin-postcss';
55
import filesize from 'rollup-plugin-filesize';
66
import autoprefixer from 'autoprefixer';
7-
import localResolve from 'rollup-plugin-local-resolve';
87

98
import pkg from './package.json';
109

@@ -14,6 +13,7 @@ const OUTPUT_NAME = 'Example';
1413
const GLOBALS = {
1514
react: 'React',
1615
'react-dom': 'ReactDOM',
16+
'prop-types': 'PropTypes',
1717
};
1818

1919
const PLUGINS = [
@@ -24,11 +24,16 @@ const PLUGINS = [
2424
],
2525
}),
2626
babel({
27+
babelHelpers: 'runtime',
2728
exclude: 'node_modules/**',
2829
}),
29-
localResolve(),
3030
resolve({
3131
browser: true,
32+
resolveOnly: [
33+
/^(?!react$)/,
34+
/^(?!react-dom$)/,
35+
/^(?!prop-types)/,
36+
],
3237
}),
3338
commonjs(),
3439
filesize(),
@@ -37,6 +42,7 @@ const PLUGINS = [
3742
const EXTERNAL = [
3843
'react',
3944
'react-dom',
45+
'prop-types',
4046
];
4147

4248
const OUTPUT_DATA = [

0 commit comments

Comments
 (0)