Skip to content
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

webpack 使用记录 #6

Open
RonkTsang opened this issue Jun 19, 2018 · 0 comments
Open

webpack 使用记录 #6

RonkTsang opened this issue Jun 19, 2018 · 0 comments
Labels
学习记录 记录学习过程中遇到的问题、或者心得

Comments

@RonkTsang
Copy link
Owner

Node 模块的 polyfill

在引入 Vue 时,webpack 会很好心的帮我们引入几个垫片库 /buildin/global.js, ./node_modules/setimmediate/setImmediate.js, ./node_modules/timers-browserify/main.js, ./node_modules/process/browser.js, 为啥呢?

官方文档:

这些选项可以配置是否 polyfill 或 mock 某些 Node.js 全局变量和模块。这可以使最初为 Node.js 环境编写的代码,在其他环境(如浏览器)中运行。

之前使用场景都是浏览器,所以这样的 polyfill 是可行的,但是在当前的环境中是不可行的。

解决:

// webpack config
node: false

官方文档:Node

@RonkTsang RonkTsang added the 学习记录 记录学习过程中遇到的问题、或者心得 label Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
学习记录 记录学习过程中遇到的问题、或者心得
Projects
None yet
Development

No branches or pull requests

1 participant