Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7fa1cf

Browse files
committed
fix: always transpile syntaxes introduced in ES2020 or later
To fix compatibility issues with webpack 4 and ESLint 6.Browserslist doesn't support ES version queries, so we approximate itas Chrome 79.0.0 and Node.js 12Fixes#7209
1 parent5b57792 commitc7fa1cf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎packages/@vue/babel-preset-app/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,21 @@ module.exports = (context, options = {}) => {
176176

177177
// resolve targets for preset-env
178178
lettargets=getTargets(rawTargets,{ ignoreBrowserslistConfig, configPath})
179+
180+
// Webpack 4 uses acorn 6 underlyingly;
181+
// The highest ESLint version that Vue CLI v4 supports is 6.x;
182+
// Both can only parse ES2019 syntax + BigInt at most.
183+
// Thus, newer syntaxes such as optional chaining and nullish coalescing won't
184+
// be accept by webpack / ESLint, and must be processed by Babel first.
185+
// Chrome 79 is the last Chrome version that doesn't support these syntaxes.
186+
// So the targets set by the user cannot be higher than Chrome 79.
187+
if(!targets.chrome||semver.gt(targets.chrome,'79.0.0')){
188+
targets.chrome='79.0.0'
189+
}
190+
179191
if(process.env.VUE_CLI_BABEL_TARGET_NODE){
180192
// running tests in Node.js
181-
targets={node:'current'}
193+
targets={node:'12'}
182194
}elseif(process.env.VUE_CLI_BUILD_TARGET==='wc'||process.env.VUE_CLI_BUILD_TARGET==='wc-async'){
183195
// targeting browsers that at least support ES2015 classes
184196
targets=getWCTargets(targets)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp