forked from UMCreadme/Read_Me_Node.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
33 lines (31 loc) Β· 1001 Bytes
/
Copy pathwebpack.config.js
File metadata and controls
33 lines (31 loc) Β· 1001 Bytes
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
import nodeExternals from 'webpack-node-externals';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
mode: "production", // λ°°ν¬ λͺ¨λλ‘ μ€μ
entry: './index.js', // μλ² μ½λμ μ§μ
μ
output: {
path: path.resolve(__dirname, "dist"),
filename: "main.cjs", // CommonJS νμμΌλ‘ μΆλ ₯
libraryTarget: "commonjs2" // CommonJS νμμΌλ‘ μΆλ ₯
},
module: {
rules: [
{
test: /\.m?js$/, // .mjsμ .js νμΌμ μ²λ¦¬
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"]
}
},
exclude: /node_modules/
}
]
},
target: "node",
externalsPresets: { node: true },
externals: [nodeExternals()],
};