Bundle: Produced from a number of distinct modules, bundles contain the final versions of source files that have already undergone the loading and compilation process.Bundle: bundle通常是由多个不同的模块产生,它是已经加载完毕和被编译后的源代码的最终版本。Bundle Splitting: This process offers one way of optimizing a build, allowing webp
使用webpack项目打包以后的项目在Chrome、Safari 下运行正常,但是在IE11下运行失败!提示 vuex requires a Promise polyfill in this browser。
一脸迷惑,原来是这样的。babel默认只转换语法,而不转换新的API,如需使用新的API,还需要使用对应的转换插件或者polyfill。例如,默认情况下babel可以将箭头函数,class等语法转换为ES5兼容的形式,但是却不能转换Map,Set,Promise等新的全局对象,这时候就需要使用polyfill去模拟这些新特性
babel-polyfill
原理是当运行环境中并没
为什么使用 HtmlWebpackPlugin
使用webpack命令打包,默认是不能生成html文件的,我以前的解决方法,就是在webpack output的目录中,添加一个index.html文件,index.html文件的内容如下:
!DOCTYPE html
html lang="zh-cn"
head
title 首页 /title
meta charset="utf-8"
meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui"
这个倒霉错误在mac电脑上开发的时候非常顺利,可是用windows的时候就会报错。
百度查不到,google一查果然有。
原因是:The code above is ok. You can mix require and export. You can‘t mix import and module.exports.
也就是说,在webpack打包的时候,可以在js文件中混用require和export。但是不能混用import 以及module.exports。
于是查了一下代码,在自己的main.js中有这一段代码:
webpack-dev-server --port 3000 --hot
would allow the server to be accessed at:
http://localhost:3000 and
http://10.0.1.4:3000 (my local IP).
In 1.8.0 accessing http://10.0.1.4:3000 no longer works.
Not sure if this has to do with webpack-dev-server or one of the dependencies.