-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
37 lines (36 loc) · 1 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
const path = require("path");
module.exports = {
mode: "development",
entry: "./src/app.js",
output: {
path: path.join(__dirname, "public"),
filename: "bundle.js"
},
//Customize the behaviour of webpack when it loads a specific file
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader" //loader allows as to give only one entry
},
{
test: /\.s?css$/,
use: [ //use allows as to give an array of entries
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS, using Node Sass by default
]
}
]
},
// show original source code so we don't get lost inside bundle.js when errors happen
devtool: "cheap-module-eval-source-map",
// use dev server
devServer: {
contentBase: path.join(__dirname, "public"),
watchContentBase: true,
compress: false,
port: 9000
}
};