build: babel output for package building

This commit is contained in:
07akioni 2020-12-16 10:57:40 +08:00
parent 4448456056
commit 024dd95ca5
3 changed files with 8 additions and 3 deletions

View File

@ -1,10 +1,11 @@
// the file is used for jest testing & site building
// > 2%, make template string not compiled to concat, since it's not fast
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: 'defaults, not IE 11'
targets: '>2%, not IE 11'
}
]
]

View File

@ -58,7 +58,7 @@
]
},
"devDependencies": {
"@babel/preset-env": "^7.12.7",
"@babel/preset-env": "^7.12.10",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-replace": "^2.3.4",

View File

@ -2,9 +2,10 @@ const cssRenderPlugin = require('./build/rollup-plugin-css-render')
const { nodeResolve } = require('@rollup/plugin-node-resolve')
const { terser } = require('rollup-plugin-terser')
const replace = require('@rollup/plugin-replace')
const { babel } = require('@rollup/plugin-babel')
function externalValidator (patterns) {
return id => patterns.some(pattern => id.startsWith(pattern))
return (id) => patterns.some((pattern) => id.startsWith(pattern))
}
// do not use babel when build library, use it when only build the site
@ -31,6 +32,9 @@ module.exports = {
extensions: ['.js', '.json']
}),
cssRenderPlugin(),
babel({
babelHelpers: 'bundled'
}),
terser({
mangle: false,
output: {