Skip to content

Patch 1 #5475

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

Closed
wants to merge 2 commits into from
Closed

Patch 1 #5475

wants to merge 2 commits into from

Conversation

ucev
Copy link

@ucev ucev commented May 13, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

更新浏览器兼容的doc

ucev added 2 commits May 13, 2020 11:24
core-js下已经不存在stable模块;@babel/preset-env中对`useBuiltIns: 'entry'`配置推荐使用`import 'core-js'`
@@ -38,9 +38,9 @@
我们推荐以这种方式添加 polyfill 而不是在源代码中直接导入它们,因为如果这里列出的 polyfill 在 `browserslist` 的目标中不需要,则它会被自动排除。
:::

3. **如果该依赖交付 ES5 代码,但使用了 ES6+ 特性且没有显式地列出需要的 polyfill (例如 Vuetify):**请使用 `useBuiltIns: 'entry'` 然后在入口文件添加 `import 'core-js/stable'; import 'regenerator-runtime/runtime';`。这会根据 `browserslist` 目标导入**所有** polyfill,这样你就不用再担心依赖的 polyfill 问题了,但是因为包含了一些没有用到的 polyfill 所以最终的包大小可能会增加。
3. **如果该依赖交付 ES5 代码,但使用了 ES6+ 特性且没有显式地列出需要的 polyfill (例如 Vuetify):**请使用 `useBuiltIns: 'entry'` 然后在入口文件添加 `import 'core-js'; import 'regenerator-runtime/runtime';`。这会根据 `browserslist` 目标导入**所有** polyfill,这样你就不用再担心依赖的 polyfill 问题了,但是因为包含了一些没有用到的 polyfill 所以最终的包大小可能会增加。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

babel 文档里写的就是 core-js/stable https://babeljs.io/docs/en/babel-polyfill
请不要改掉

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,发现是版本问题,有的core-js版本没有core-js/stable。使用vue-cli创建的项目使用的core-js有stable包。

haoqunjiang added a commit to haoqunjiang/vue-cli that referenced this pull request Jun 22, 2020
haoqunjiang added a commit that referenced this pull request Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants