-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrading to @vue/cli-plugin-babel@4.5.18 causes compilation failure #7209
Comments
不知道咋了,用了es7语法就不行,你的这个??是ES7语法, 我的用了?.和你发生的问题一样。。。。 |
yo, man, i encountered same problem, but i already solved i. The following methods: add following config into the babel.config.js: and just in case, maybe u need: |
手动加 presets: [ ['@babel/preset-env'] ],也可以解决, 主要是更新了什么,以前不用配置啊 |
This comment was marked as outdated.
This comment was marked as outdated.
Same problem, existing projects using optional chaining operators running until 4.5.17 cannot be compiled in 4.5.18 anymore. |
Oh, I got it. It's because IE 11 has reached end-of-life. |
手动加了 下面这个方法有效,但没想明白原因,按babel官方讲的这两个插件都是包含在
|
@bwangs 而不包含 IE 11 的、满足 "> 1%, not dead, last 2 versions" 的所有浏览器,都支持最新的语法标准,所以 至于这个 issue 里出现的报错,则是因为项目的依赖版本比较老,除了 Babel 以外,其他的工具比如 webpack 4 是不支持新语法的,所以如果 Babel 不再把代码转换好再输出给它们,它们就会报无法解析的错误。 |
I've posted a Twitter thread to explain the underlying issue here: https://twitter.com/haoqunjiang/status/1539857134317600769 |
@bwangs 不应该啊!你加的那两个也都是preset-env包含的,一个是?. 一个??语法转换插件么? |
@sodatea 嗯,试了下加上IE11确实有效,想了下应该IE11退役导致babel不在转译了这个原因 |
@chinaxcy 这两个插件是这个两个转译功能。
|
不锁死版本太可怕,很有可能时隔几年的项目跑都跑步起来了 |
@sodatea 致敬大佬 ! |
@ShuangDa1018 与版本无关,这个方法有效
|
@ShuangDa1018 回退可以,我试过但是保证browserlist也回退到相应的版本 |
@bwangs 怎么和版本无关呢?这一天天的,迷糊的呢? |
This appears to be it @sodatea, good eye! |
|
Hello @sodatea Is a fix for vue-cli@4 is planned ? Because a new project generated with this version breaks. I know that V5 is the current version but it can be great to fix v4. In our company we have lots of v4 projects, it is just to know if we have to do a "permanant" fix or if the CLI will be patched. Thans for the response. |
@sodatea 牛啊牛啊 |
To fix compatibility issues with webpack 4 and ESLint 6. Browserslist doesn't support ES version queries, so we approximate it as Chrome 79.0.0 and Node.js 12 Fixes #7209
@Benoit-Vasseur I've just released 4.5.19 to add an upper limit of browser targets, to fix the But for IE 11 support, we can't make the decision for the users, so if you still have to support IE in your projects, it must be manually specified in the browserslist configuration. |
Version
4.5.18
Reproduction link
github.com
Environment info
Steps to reproduce
You can build the existing project via: npm run build:dev
When targeting @vue/cli-plugin-babel@4.5.17 the project builds without errors. Targeting @vue/cli-plugin-babel@4.5.18 produces compilation errors.
What is expected?
The expectation would be to compile without error.
What is actually happening?
Failed to compile with 1 error 11:59:22 a.m.
error in ./src/main.ts
Module parse failed: Unexpected token (18:41)
File was processed with these loaders:
You may need an additional loader to handle the result of these loaders.
| args[key] = value;
| });
@ multi ./src/main.ts
I have stripped out pretty much everything in order to exhibit the behavior.
Background: We utilize main.ts to either launch our full app (TheShell) or to launch containerized components (inline or in new windows). I have removed all of the containerized components.
The text was updated successfully, but these errors were encountered: