-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
53 lines (48 loc) · 1.08 KB
/
webpack.config.js
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import path from "path"
import TerserPlugin from "terser-webpack-plugin"
// Global paths and helpers
import { paths, isProduction, isDevelopment } from "./gulp_tasks/_helpers"
// Scripts paths
const js = {
src: `${paths.source + paths.assets}/js`,
dest: `${paths.public + paths.assets}/js`,
entry: "/main",
extensions: "js",
name: "app",
}
const config = {
mode: isProduction() ? "production" : "development",
entry: path.resolve(__dirname, `${js.src + js.entry}.${js.extensions}`),
output: {
filename: `${js.name}.${js.extensions}`,
path: path.resolve(__dirname, js.dest),
},
module: {
rules: [
{
test: /\.js$/,
loader: "babel-loader",
},
],
},
optimization: {
minimize: isProduction(),
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false,
},
compress: {
drop_console: true,
},
},
extractComments: false,
}),
],
},
}
if (isDevelopment()) {
config.devtool = "source-map"
}
module.exports = config