generated from web-infra-dev/rspack-repro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.mjs
34 lines (31 loc) · 834 Bytes
/
config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import path from "path";
import { fileURLToPath } from "url";
import HtmlWebpackPlugin from "html-webpack-plugin";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const isRunningWebpack = !!process.env.WEBPACK;
const isRunningRspack = !!process.env.RSPACK;
if (!isRunningRspack && !isRunningWebpack) {
throw new Error("Unknown bundler");
}
/**
* @type {import('webpack').Configuration | import('@rspack/cli').Configuration}
*/
const config = {
mode: "development",
devtool: false,
entry: {
main: "./src/index",
},
plugins: [new HtmlWebpackPlugin()],
output: {
clean: true,
path: isRunningWebpack
? path.resolve(__dirname, "webpack-dist")
: path.resolve(__dirname, "rspack-dist"),
filename: "[name].js",
},
experiments: {
css: true,
},
};
export default config;