-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
61 lines (59 loc) · 1.67 KB
/
Copy pathwebpack.config.js
File metadata and controls
61 lines (59 loc) · 1.67 KB
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
54
55
56
57
58
59
60
61
const path = require('path');
// to run webpack dev server, need this plugin for the index.html file
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
//**** WE HAD TO GO BACK A VERSION FOR WEBPACK DEV SERVER TO 4.0.0
module.exports = {
mode: process.env.NODE_ENV,
entry: {
index: './client/index.js'
},
output: {
filename: './bundle.js',
path: path.resolve(__dirname, 'build')
},
module: {
rules:[
{
test: /\.jsx?/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
// plugins: ['@babel/plugin-transform-runtime', '@babel/transform-async-to-generator'],
}
},
{
test: /\.scss?/,
use: [
// for mini-css-extract plugin
// MiniCssExtractPlugin.loader,
// Creates `style` nodes from JS strings
"style-loader",
// Translates CSS into CommonJS
"css-loader",
// Compiles Sass to CSS
"sass-loader"
]
}
]
},
devServer: {
static: {
publicPath: '/',
directory: path.join(__dirname, 'build'),
},
compress: true,
hot: true, // enables hot reloading
proxy: {
'/api': 'http://localhost:3000'
}
},
plugins: [
// new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
title: 'development',
template: 'client/index.html'
})
],
};