Skip to content

Commit

Permalink
build: setup babel helpers as runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Nov 13, 2022
1 parent d1ae810 commit aa7bd5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"env": {
"production": {
"plugins": [
"@babel/plugin-transform-react-constant-elements"
"@babel/plugin-transform-react-constant-elements",
"@babel/plugin-transform-runtime"
]
}
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
"devDependencies": {
"@babel/eslint-parser": "latest",
"@babel/plugin-transform-react-constant-elements": "latest",
"@babel/plugin-transform-runtime": "latest",
"@babel/preset-env": "latest",
"@babel/preset-react": "latest",
"@babel/runtime": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@rollup/plugin-babel": "latest",
Expand Down
7 changes: 4 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import external from 'rollup-plugin-peer-deps-external'
import { visualizer } from 'rollup-plugin-visualizer'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript'
import filesize from 'rollup-plugin-filesize'
import terser from '@rollup/plugin-terser'
import babel from '@rollup/plugin-babel'
import typescript from '@rollup/plugin-typescript'
import fs from 'fs'

import pkg from './package.json'
Expand All @@ -12,6 +12,7 @@ const babelRc = JSON.parse(fs.readFileSync('./.babelrc'))

export default {
input: 'src/index.ts',
external: [/@babel\/runtime/],
output: [
{
file: pkg.main,
Expand All @@ -30,7 +31,7 @@ export default {
}),
babel({
babelrc: false,
babelHelpers: 'inline',
babelHelpers: 'runtime',
...babelRc
}),
typescript(),
Expand Down

0 comments on commit aa7bd5b

Please sign in to comment.