mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-26 00:59:02 -06:00
feat: apply minimal transpilation when building as web component
This commit is contained in:
@@ -48,11 +48,30 @@ module.exports = (context, options = {}) => {
|
||||
decoratorsLegacy
|
||||
} = options
|
||||
|
||||
const targets = process.env.VUE_CLI_BABEL_TARGET_NODE
|
||||
? { node: 'current' }
|
||||
: process.env.VUE_CLI_MODERN_BUILD
|
||||
? { esmodules: true }
|
||||
: rawTargets
|
||||
// resolve targets
|
||||
let targets
|
||||
if (process.env.VUE_CLI_BABEL_TARGET_NODE) {
|
||||
// running tests in Node.js
|
||||
targets = { node: 'current' }
|
||||
} else if (process.env.VUE_CLI_BUILD_TARGET === 'wc' || process.env.VUE_CLI_BUILD_TARGET === 'wc-async') {
|
||||
// targeting browsers that at least support ES2015 classes
|
||||
// https://github.com/babel/babel/blob/master/packages/babel-preset-env/data/plugins.json#L52-L61
|
||||
targets = {
|
||||
browsers: [
|
||||
'Chrome >= 49',
|
||||
'Firefox >= 45',
|
||||
'Safari >= 10',
|
||||
'Edge >= 13',
|
||||
'iOS >= 10',
|
||||
'Electron >= 0.36'
|
||||
]
|
||||
}
|
||||
} else if (process.env.VUE_CLI_MODERN_BUILD) {
|
||||
// targeting browsers that support <script type="module">
|
||||
targets = { esmodules: true }
|
||||
} else {
|
||||
targets = rawTargets
|
||||
}
|
||||
|
||||
// included-by-default polyfills. These are common polyfills that 3rd party
|
||||
// dependencies may rely on (e.g. Vuex relies on Promise), but since with
|
||||
|
||||
Reference in New Issue
Block a user