mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-14 09:52:26 +03:00
fix: babel config for rollup
This commit is contained in:
+11
-9
@@ -1,15 +1,17 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"plugins": ["@babel/plugin-syntax-dynamic-import"],
|
env: {
|
||||||
"env": {
|
test: {
|
||||||
"test": {
|
plugins: [
|
||||||
"plugins": ["dynamic-import-node"],
|
'@babel/plugin-syntax-dynamic-import',
|
||||||
"presets": [
|
'dynamic-import-node'
|
||||||
[ "@babel/env", {
|
],
|
||||||
|
presets: [
|
||||||
|
[ '@babel/preset-env', {
|
||||||
targets: {
|
targets: {
|
||||||
node: "current"
|
node: 'current'
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-12
@@ -18,6 +18,18 @@ const banner = `/**
|
|||||||
*/
|
*/
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const babelConfig = () => ({
|
||||||
|
presets: [
|
||||||
|
['@babel/preset-env', {
|
||||||
|
targets: {
|
||||||
|
node: 8,
|
||||||
|
ie: 9,
|
||||||
|
safari: '5.1'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
function rollupConfig({
|
function rollupConfig({
|
||||||
plugins = [],
|
plugins = [],
|
||||||
...config
|
...config
|
||||||
@@ -50,8 +62,9 @@ function rollupConfig({
|
|||||||
plugins: [
|
plugins: [
|
||||||
json(),
|
json(),
|
||||||
nodeResolve(),
|
nodeResolve(),
|
||||||
|
replace(replaceConfig),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
replace(replaceConfig)
|
babel(babelConfig()),
|
||||||
].concat(plugins),
|
].concat(plugins),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -61,10 +74,7 @@ export default [
|
|||||||
{
|
{
|
||||||
output: {
|
output: {
|
||||||
file: pkg.web,
|
file: pkg.web,
|
||||||
},
|
}
|
||||||
plugins: [
|
|
||||||
babel()
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
// minimized umd web build
|
// minimized umd web build
|
||||||
{
|
{
|
||||||
@@ -72,7 +82,6 @@ export default [
|
|||||||
file: pkg.web.replace('.js', '.min.js'),
|
file: pkg.web.replace('.js', '.min.js'),
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
babel(),
|
|
||||||
terser()
|
terser()
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -83,9 +92,6 @@ export default [
|
|||||||
file: pkg.main,
|
file: pkg.main,
|
||||||
format: 'cjs'
|
format: 'cjs'
|
||||||
},
|
},
|
||||||
plugins: [
|
|
||||||
babel()
|
|
||||||
],
|
|
||||||
external: Object.keys(pkg.dependencies)
|
external: Object.keys(pkg.dependencies)
|
||||||
},
|
},
|
||||||
// esm build
|
// esm build
|
||||||
@@ -95,9 +101,6 @@ export default [
|
|||||||
file: pkg.web.replace('.js', '.esm.js'),
|
file: pkg.web.replace('.js', '.esm.js'),
|
||||||
format: 'es'
|
format: 'es'
|
||||||
},
|
},
|
||||||
plugins: [
|
|
||||||
babel()
|
|
||||||
],
|
|
||||||
external: Object.keys(pkg.dependencies)
|
external: Object.keys(pkg.dependencies)
|
||||||
},
|
},
|
||||||
// browser esm build
|
// browser esm build
|
||||||
|
|||||||
Reference in New Issue
Block a user