-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
59 lines (56 loc) · 1.2 KB
/
webpack.dev.js
File metadata and controls
59 lines (56 loc) · 1.2 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
import { merge } from 'webpack-merge';
import common from './webpack.common';
import { resolve, join } from 'path';
import { platform } from 'process';
let chrome;
if (platform === 'win32') chrome = 'chrome';
if (platform === 'linux') chrome = 'google-chrome';
if (platform === 'darwin') chrome = 'Google Chrome';
const config = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
output: {
filename: '[name].js',
path: resolve(__dirname, '/public/'),
publicPath: '/'
},
devServer: {
static: {
directory: join(__dirname, 'public'),
},
port: 5050,
open: {
app: {
name: chrome,
arguments: ['--new-window']
}
}
},
module: {
rules: [
{
test: /\.(js|jsx)$/i,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react']
}
}
},
{
test: /\.(css|less)$/i,
use: [
'style-loader',
'css-loader',
'less-loader'
]
},
{
test: /\.svg$/,
use: ['@svgr/webpack']
}
]
}
});
export default config;