-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
45 lines (41 loc) · 1.3 KB
/
webpack.config.js
File metadata and controls
45 lines (41 loc) · 1.3 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
const path = require('path');
module.exports = {
// This is the entry point or start of our react applicaton
entry: "./app/app.js",
// The plain compiled JavaScript will be output into this file
output: {
path: path.resolve(__dirname, 'public'),
filename: "bundle.js",
publicPath: '/'
},
// This section desribes the transformations we will perform
module: {
rules: [
{
// Only working with files that in in a .js or .jsx extension
test: /\.jsx?$/,
// Webpack will only process files in our app folder. This avoids processing
// node modules and server files unnecessarily
include: /app/,
loader: "babel-loader",
options: {
presets: ["@babel/preset-react", "@babel/preset-env"],
plugins: ["@babel/plugin-proposal-class-properties"]
}
},
{test: /\.css$/,
use : [
{loader: 'style-loader'},
{loader: 'css-loader'}
]},
{test: /\.(png|jpg|jpeg)$/,
use : [
{loader: 'url-loader'}
]}
]
},
// This lets us debug our react code in chrome dev tools. Errors will have lines and file names
// Without this the console says all errors are coming from just coming from bundle.js
devtool: "eval-source-map",
mode: 'development'
};