因此,我正在嘗試設(shè)置此應(yīng)用程序,以便可以開始對(duì)其進(jìn)行編碼。但每次我構(gòu)建應(yīng)用程序時(shí);webpack 會(huì)自動(dòng)添加auto/file.js到 script 標(biāo)簽,但它實(shí)際上應(yīng)該是:file.js。所以它auto/自己添加了該部分。我已經(jīng)檢查了每個(gè) webpack 配置文件,但我無法理解為什么它會(huì)auto/在我的腳本中添加前綴。還要提一下這是一個(gè) ElectronJS 項(xiàng)目。這是我的 webpack 配置。webpack.config.jsconst mainConfig = require("./webpack.main.config");const rendererConfig = require("./webpack.renderer.config");const config = [mainConfig, rendererConfig];module.exports = config;webpack.base.config.jsconst UglifyJsPlugin = require("uglifyjs-webpack-plugin");const config = { plugins: [ new UglifyJsPlugin({ test: /\.js($|\?)/i, sourceMap: true, uglifyOptions: { compress: true } }) ]};module.exports = config;webpack.main.config.js const path = require("path"); const merge = require("webpack-merge");const base = require("./webpack.base.config");const buildPath = path.resolve(__dirname, "./dist");const main = merge(base, { entry: "./main.js", output: { filename: "main.js", path: buildPath }, module: { rules: [ { test: /\.js$/, exclude: /node_modules/, use: "babel-loader" }, ] }, node: { __dirname: false, __filename: false }, target: "electron-main"});module.exports = main;
Webpack 在構(gòu)建的 html 文件中的腳本標(biāo)簽中添加“auto/”
滄海一幻覺
2023-08-18 14:21:03