2025-07-16 22:29:28 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
2025-04-22 18:49:30 +08:00
|
|
|
const fs = require("fs");
|
|
|
|
|
const join = require("path").join;
|
2025-07-03 17:06:45 +08:00
|
|
|
const webpack = require("../../../");
|
2018-03-19 11:20:44 +08:00
|
|
|
|
2025-04-22 20:42:33 +08:00
|
|
|
/**
|
|
|
|
|
* @param {string} path path
|
|
|
|
|
* @returns {string} JSON content of a file
|
|
|
|
|
*/
|
2018-03-19 11:20:44 +08:00
|
|
|
function read(path) {
|
2018-07-12 23:12:00 +08:00
|
|
|
return JSON.stringify(
|
|
|
|
|
fs.readFileSync(join(__dirname, path), "utf8").replace(/\r\n?/g, "\n")
|
|
|
|
|
);
|
2018-03-19 11:20:44 +08:00
|
|
|
}
|
|
|
|
|
|
2020-04-20 15:23:10 +08:00
|
|
|
/** @type {import("../../../").Configuration[]} */
|
2015-09-03 20:17:11 +08:00
|
|
|
module.exports = [
|
|
|
|
|
{
|
2017-11-21 17:41:01 +08:00
|
|
|
mode: "production",
|
2015-09-03 20:17:11 +08:00
|
|
|
entry: "./index",
|
2019-11-05 17:04:01 +08:00
|
|
|
output: {
|
|
|
|
|
filename: "123.js"
|
|
|
|
|
},
|
2015-09-03 20:17:11 +08:00
|
|
|
plugins: [
|
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
|
VALUE: "123"
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
},
|
2018-01-19 16:21:00 +08:00
|
|
|
|
2015-09-03 20:17:11 +08:00
|
|
|
{
|
2017-11-21 17:41:01 +08:00
|
|
|
mode: "production",
|
2015-09-03 20:17:11 +08:00
|
|
|
entry: "./index",
|
2019-11-05 17:04:01 +08:00
|
|
|
output: {
|
|
|
|
|
filename: "321.js"
|
|
|
|
|
},
|
2015-09-03 20:17:11 +08:00
|
|
|
plugins: [
|
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
|
VALUE: "321"
|
|
|
|
|
})
|
|
|
|
|
]
|
2018-03-19 11:20:44 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
mode: "production",
|
|
|
|
|
entry: "./index",
|
2019-11-05 17:04:01 +08:00
|
|
|
output: {
|
|
|
|
|
filename: "both.js"
|
|
|
|
|
},
|
2018-03-19 11:20:44 +08:00
|
|
|
plugins: [
|
|
|
|
|
new webpack.DefinePlugin({
|
2021-05-11 15:31:46 +08:00
|
|
|
VALUE: webpack.DefinePlugin.runtimeValue(
|
|
|
|
|
() => read("123.txt"),
|
|
|
|
|
[join(__dirname, "./123.txt")]
|
|
|
|
|
)
|
2018-03-19 11:20:44 +08:00
|
|
|
}),
|
|
|
|
|
new webpack.DefinePlugin({
|
2021-05-11 15:31:46 +08:00
|
|
|
VALUE: webpack.DefinePlugin.runtimeValue(
|
|
|
|
|
() => read("321.txt"),
|
|
|
|
|
[join(__dirname, "./321.txt")]
|
|
|
|
|
)
|
2018-03-19 11:20:44 +08:00
|
|
|
})
|
|
|
|
|
]
|
2023-04-24 02:42:05 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
mode: "production",
|
|
|
|
|
entry: "./index",
|
|
|
|
|
output: {
|
2023-04-26 10:41:52 +08:00
|
|
|
filename: "log.js"
|
2023-04-24 02:42:05 +08:00
|
|
|
},
|
|
|
|
|
infrastructureLogging: {
|
|
|
|
|
debug: /DefinePlugin/,
|
|
|
|
|
level: "none"
|
|
|
|
|
},
|
|
|
|
|
stats: {
|
|
|
|
|
loggingDebug: /DefinePlugin/,
|
|
|
|
|
logging: "none"
|
|
|
|
|
},
|
|
|
|
|
plugins: [
|
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
|
VALUE: "123"
|
|
|
|
|
})
|
|
|
|
|
]
|
2015-09-03 20:17:11 +08:00
|
|
|
}
|
|
|
|
|
];
|