Skip to content

Commit 9d0dc69

Browse files
authored
[v2] drop es5 (#865)
1 parent 36b998b commit 9d0dc69

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

package.json

-5
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,8 @@
107107
"proxy-compare": "2.6.0"
108108
},
109109
"devDependencies": {
110-
"@babel/core": "^7.24.0",
111-
"@babel/plugin-transform-react-jsx": "^7.23.4",
112-
"@babel/plugin-transform-typescript": "^7.23.6",
113-
"@babel/preset-env": "^7.24.0",
114110
"@redux-devtools/extension": "^3.3.0",
115111
"@rollup/plugin-alias": "^5.1.0",
116-
"@rollup/plugin-babel": "^6.0.4",
117112
"@rollup/plugin-node-resolve": "^15.2.3",
118113
"@rollup/plugin-replace": "^5.0.5",
119114
"@rollup/plugin-typescript": "^11.1.6",

rollup.config.js

+6-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const path = require('path')
22
const alias = require('@rollup/plugin-alias')
3-
const babelPlugin = require('@rollup/plugin-babel')
43
const resolve = require('@rollup/plugin-node-resolve')
54
const replace = require('@rollup/plugin-replace')
65
const typescript = require('@rollup/plugin-typescript')
@@ -19,24 +18,9 @@ function external(id) {
1918
return !id.startsWith('.') && !id.startsWith(root)
2019
}
2120

22-
function getBabelOptions(targets) {
23-
return {
24-
babelrc: false,
25-
ignore: ['./node_modules'],
26-
presets: [['@babel/preset-env', { loose: true, modules: false, targets }]],
27-
plugins: [
28-
['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }],
29-
['@babel/plugin-transform-typescript', { isTSX: true }],
30-
],
31-
extensions,
32-
comments: false,
33-
babelHelpers: 'bundled',
34-
}
35-
}
36-
37-
function getEsbuild(env = 'development') {
21+
function getEsbuild(format) {
3822
return esbuild({
39-
minify: env === 'production',
23+
format,
4024
target: 'es2018',
4125
supported: { 'import-meta': true },
4226
tsconfig: path.resolve('./tsconfig.json'),
@@ -80,15 +64,15 @@ function createESMConfig(input, output) {
8064
delimiters: ['\\b', '\\b(?!(\\.|/))'],
8165
preventAssignment: true,
8266
}),
83-
getEsbuild(),
67+
getEsbuild('esm'),
8468
],
8569
}
8670
}
8771

8872
function createCommonJSConfig(input, output) {
8973
return {
9074
input,
91-
output: { file: `${output}.js`, format: 'cjs' },
75+
output: { file: output, format: 'cjs' },
9276
external,
9377
plugins: [
9478
alias({ entries: entries.filter((e) => !e.find.test(input)) }),
@@ -98,7 +82,7 @@ function createCommonJSConfig(input, output) {
9882
delimiters: ['\\b', '\\b(?!(\\.|/))'],
9983
preventAssignment: true,
10084
}),
101-
babelPlugin(getBabelOptions({ ie: 11 })),
85+
getEsbuild('cjs'),
10286
],
10387
}
10488
}
@@ -112,7 +96,7 @@ module.exports = function (args) {
11296
}
11397
return [
11498
...(c === 'index' ? [createDeclarationConfig(`src/${c}.ts`, 'dist')] : []),
115-
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`),
99+
createCommonJSConfig(`src/${c}.ts`, `dist/${c}.js`),
116100
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.mjs`),
117101
]
118102
}

0 commit comments

Comments
 (0)