每次weex编译都会卡在asset optimization 94%

最新新版本weex-toolkit 脚手架会不会有这问题。

老版本需要做如下修改

webpack.dev.conf.js 文件中修改html-webpack-plugin为html-webpack-plugin-for-multihtml

1
const HtmlWebpackPlugin = require('html-webpack-plugin-for-multihtml');

并在声明HtmlWebpackPlugin的地方加上multihtmlCache: true

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const generateHtmlWebpackPlugin = (entry) => {
let entrys = Object.keys(entry);
// exclude vendor entry.
entrys = entrys.filter(entry => entry !== 'vendor' );
const htmlPlugin = entrys.map(name => {
return new HtmlWebpackPlugin({
multihtmlCache: true,
filename: name + '.html',
template: helper.rootNode(`web/index.html`),
isDevServer: true,
chunksSortMode: 'dependency',
inject: true,
devScripts: config.dev.htmlOptions.devScripts,
chunks: ['vendor', name]
})
})
return htmlPlugin;
}

最后安装一下新module html-webpack-plugin-for-multihtml
在工程根目录npm install html-webpack-plugin-for-multihtml