Description
What problem does this feature solve?
英文不好,在线翻译的,如有语法错误,请忽视!
Using tool translation. If grammatical errors, please ignore.
我的 node.js 工程和 view 工程是分来的,构建好的静态资源会放入到 cdn ,node 只负责提供数据和渲染错误,授权等页面,可是这样就会有 2 套 webpack 配置。
My node.js project and view project are divided, the built static resources will be put into the CDN, node is only responsible for providing data and rendering errors, authorization and other pages, but there will be 2 sets of webpack configurations.
现在想从 node.js 移动到 view 工程中去,这样可以共享同一套 ui 和配置。
Now want to move from node.js move to view project, so can share the same set of UI and configuration.
但是这些页面为了能快速渲染,不想引入任何公共模块,希望能针对单个 ‘entry’ 提供 html-webpack-plugin
的插件选项 。
But for quick rendering, these pages do not want to introduce any common modules, hoping to provide html-webpack-plugin
plug-in options for a single 'entry'.
What does the proposed API look like?
module.exports = {
pages: {
...,
// 给个函数将默认配置传递进来,开发者可以自由选择替换那些内容
error (options) {
return Object.assign(options, {
entry: 'src/error.js',
template: 'public/error.html',
filename: 'error.html',
chunks: ['error']
})
},
...
}
}