-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
47 lines (43 loc) · 1.21 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
38
39
40
41
42
43
44
45
46
47
// Import webpack moduke
var webpack = require("webpack");
// Import open browser plugin
var OpenBrowserPlugin = require('open-browser-webpack-plugin');
//Import path module
const path = require('path');
module.exports = {
entry: "./src/index.js", //set entry file
// Resolve to output directory and set file
output: {
path: path.resolve("dist/assets"),
filename: "bundle.js",
publicPath: "assets"
},
// Add Url param to open browser plugin
plugins: [new OpenBrowserPlugin({url: 'http://localhost:3000'})],
// Set dev-server configuration
devServer: {
inline: true,
contentBase: './dist',
port: 3000
},
// Add babel-loader to transpile js and jsx files
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
use: [
{
loader: 'babel-loader',
query: {
presets: ["react"]
}
}
]
}, {
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
}
}