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
原理是当运行环境中并没
这个倒霉错误在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.
写在前面的话
阅读本文之前,先看下面这个webpack的配置文件,如果每一项你都懂,那本文能带给你的收获也许就比较有限,你可以快速浏览或直接跳过;如果你和十天前的我一样,对很多选项存在着疑惑,那花一段时间慢慢阅读本文,你的疑惑一定一个一个都会消失;如果你以前没怎么接触过Webpack,而你又你对webpack感兴趣,那么动手跟着本文中那个贯穿始终的例子写一次,写完以后你会发现你已明明白白的走进了Webpack的大门。
//一个常见的Webpack配置文件
var webpack = require('webpack');
var HtmlWebpackPlugin