我正在使用 WebPack 编译 ColdFusion 应用程序,一切似乎都编译得很好。正如您从下面的配置中看到的,我还尝试在 dist 文件夹中包含一个 HTML 文件,并确保在显示应用程序时调用它。
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
mode: "production",
entry: {
vendor: "./src/vendor.js",
main: "./src/index.js"
},
output: {
filename: "[name].[contenthash].bundle.js",
path: path.resolve(__dirname, "dist")
},
plugins: [
new HtmlWebPackPlugin({
template: "./src/template.cfm",
filename: "index.cfm",
minify: false
}),
new HtmlWebPackPlugin({
template: "./src/help.html",
filename: "help.html",
}),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['**/*', '!application.cfc']
})
],
module: {
rules: [
{
test: /\.html$/,
use: ["html-loader"],
},
{
test: /\.css$/,
use: [
"style-loader", //3. inject styles into dom
"css-loader", //2. turns css into common js
],
},
{
test: /\.scss$/,
use: [
"style-loader",
"css-loader",
"sass-loader"
],
}
]
}
};
摇曳的蔷薇
相关分类