-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
32 lines (30 loc) · 1.07 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
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = {
cache: false,
entry: './src/index.js',
module: {
rules: [
{ test: /\.(css|scss|sass)$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.(js|jsx)$/, use: 'babel-loader' },
{
test: /\.(png|svg|jpg|gif)$/, use: [{
loader: 'file-loader', options: {
name: f => {
let dirNameInsideAssets = path.relative(path.join(__dirname, "public"), path.dirname(f));
return `${dirNameInsideAssets}/[name].[ext]`;
}
}
}]
}
]
},
output: {
path: path.resolve(__dirname, 'build'),
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({ template: "./src/index.html", favicon: "./public/favicon.png" })
],
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development'
}