2024-02-25 04:55:37 +08:00
|
|
|
const config = require("flarum-webpack-config");
|
|
|
|
|
|
|
|
module.exports = env => {
|
|
|
|
// Determine build mode
|
|
|
|
let mode = "development";
|
|
|
|
if (env.production) {mode = "production";}
|
|
|
|
console.log("Compilation Mode: " + mode);
|
|
|
|
let flarumConfig = config({
|
|
|
|
resolve: {
|
|
|
|
extenstions: [".wasm", ".mjs", ".ts", ".tsx", ".js", ".json"]
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
resource: {
|
|
|
|
and: [/\.(js|ts)$/],
|
|
|
|
not: [/node_modules/]
|
|
|
|
},
|
|
|
|
use: [
|
|
|
|
"babel-loader",
|
|
|
|
{
|
|
|
|
loader: "ts-loader",
|
|
|
|
options: {
|
|
|
|
transpileOnly: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
flarumConfig.mode = mode;
|
|
|
|
return flarumConfig;
|
|
|
|
};
|