-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.txt
More file actions
67 lines (58 loc) · 1.38 KB
/
webpack.txt
File metadata and controls
67 lines (58 loc) · 1.38 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
62
63
64
npm i --save-dev webpack webpack-cli webpack-dev-server
touch webpack.config.js
didlm objeck modules:
rules => will tell webpack what it should listen to and how it should compile the code
##inside that paste codes below:
import path from 'path';
import HtmlWebpackPlugin from 'html-webpack-plugin';
module.exports ={
mode:'production',
entry: './src/index.js',
output: {
path: path.resolve(__dirname,'build'),
filename: 'index.bundle.js'
},
node: {
// Polyfills and mocks to run Node.js-
// environment code in non-Node environments.
console: false, // boolean | "mock"
global: true, // boolean | "mock"
process: true, // boolean
__filename: "mock", // boolean | "mock"
__dirname: "mock", // boolean | "mock"
Buffer: true, // boolean | "mock"
setImmediate: true // boolean | "mock" | "empty"
},
resolve: {
modules: ['node_modules',path.resolve(__dirname,'src')]
},
devServer:{
contentBase: path.join(__dirname,'src')
},
plugins:[
new HtmlWebpackPlugin({
template: path.join(__dirname,'src','index.html')
})
],
modules:{
rules:[
{
test:/\.(js|jsx)$/,
exclude:/node_modules/,
use:['babel-loader']
},
{
test:/\.(css|scss)$/,
use:[
'style-loader',
'css-loader',
'sass-loader'
]
},
{
test:/\.(jpg|png|jpeg|gif|mp3|svg)$/,
loaders:['file-loader']
}
]
}
};