我是捆绑程序的新手,目前正在学习 Fusebox。到目前为止,我真的很喜欢它,只是我不知道如何将它用于多页项目。到目前为止,我只能找到一个关于如何使用 webpack 做到这一点的教程,而不是 fusebox。
src 文件夹中的输入文件:
- 索引.html
- index2.html
- 索引.ts
dist 文件夹中的所需输出:
- 应用程序.js
- 供应商.js
- 索引.html
- index2.html
dist 文件夹中的实际输出:
- 应用程序.js
- 供应商.js
- 索引.html
这是我在 fuse.js 文件中的配置:
Sparky.task("config", () => {
fuse = FuseBox.init({
homeDir: "src",
output: "dist/$name.js",
hash: isProduction,
sourceMaps: !isProduction,
plugins: [
[SassPlugin(), CSSPlugin()],
CSSPlugin(),
WebIndexPlugin({
title: "Welcome to FuseBox index",
template: "src/index.html"
},
WebIndexPlugin({
title: "Welcome to FuseBox index2",
template: "src/index2.html"
},
isProduction && UglifyJSPlugin()
]
});
// vendor should come first
vendor = fuse.bundle("vendor")
.instructions("~ index.ts");
// out main bundle
app = fuse.bundle("app")
.instructions(`!> [index.ts]`);
if (!isProduction) {
fuse.dev();
}
});
在插件中设置 WebIndexPlugin 两次不起作用。使用 fusebox 设置多 html 页面项目的正确方法是什么?