Skip to content

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'`
:::

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
2 participants