This repository was archived by the owner on Dec 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
85 lines (83 loc) · 2.3 KB
/
webpack.dev.config.js
File metadata and controls
85 lines (83 loc) · 2.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const path = require("path");
const WorkboxPlugin = require('workbox-webpack-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const WORKER_FILE = path.resolve('src/js/service-worker/worker.js');
module.exports = {
mode: "development",
entry: [
"babel-polyfill",
path.resolve('src/js/main')
],
watch: true,
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules|worker\.js|service-worker/,
use: {
loader: 'babel-loader',
options: {
presets: [
"react",
["env", {
targets: {
"browsers": [
"last 2 versions",
"safari >= 7"
]
}
}]
]
}
}
}
]
},
plugins: [
new WorkboxPlugin.InjectManifest({
swSrc: WORKER_FILE,
swDest: './../worker.js',
importWorkboxFrom: 'local',
globDirectory: './dist/',
globPatterns: [
'index.html',
'manifest.json',
'robots.txt',
'img/**/*.svg',
'img/**/*.jpg',
'img/**/*.png',
'css/*.css',
'data/**/*.json',
'fonts/local/*.{woff,woff2}',
],
modifyUrlPrefix: {
'': '/'
}
}),
new BrowserSyncPlugin({
host: process.env.IP || 'localhost',
port: process.env.PORT || 8888,
single: true,
server: {
baseDir: ['./dist']
}
})
],
node: false,
output: {
path: path.resolve("dist/js"),
publicPath: "/js/",
filename: 'bundle.js'
},
resolve: {
modules: [
path.resolve('src/js'),
path.resolve('node_modules')
],
extensions: [
'.jsx',
'.js',
'.json'
]
}
};