我使用了html-webpack-plugin,以及html -pw3-template,它提供了对“注入”一些东西到窗口的支持,这些东西与由html- along plugin在webpack-dev-server中提供的html相关。
在本例中,我实际上是根据同级模块的需求生成下面的“uiContext”。我想要做的是查看该模块是否有更改,然后在更改时,告诉webpack-dev-server重新加载(对uiContext的更改)。
有什么想法?
var HtmlWebpackPlugin = require('html-webpack-plugin');
var htmlWebpackTemplate = require('html-webpack-template');
var uiContext = require('./server/ui-context');
// ...
plugins: [
new HtmlWebpackPlugin({
template: htmlWebpackTemplate,
window: {
uiContext
}
}),发布于 2016-09-08 16:18:07
对于这一点,在#440上有一个公开的票证-开发服务器。Diskodan提到了一种让它工作的黑客方法,使用nodemon:
"scripts": {
"start": "nodemon --watch webpack.config.js ./node_modules/.bin/webpack-dev-server",
}https://stackoverflow.com/questions/39275893
复制相似问题