-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
66 lines (62 loc) · 1.91 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
// Compile the source files into a bundle.
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
// Enable webpack-dev-server to get hot refresh of the app.
devServer: {
static: './dist',
open: true,
server: {
type: 'https'
}
},
module: {
rules: [
{
// Load CSS files. They can be imported into JS files.
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
resolve: {
fallback: {
"setimmediate": require.resolve("setimmediate"),
"fs": false, // Use false if you don't need file system operations in the browser
"util": require.resolve("util/"),
"buffer": require.resolve("buffer/"),
"stream": require.resolve("stream-browserify"),
"url": require.resolve("url/"),
"assert": require.resolve("assert/"),
"os": require.resolve("os-browserify/browser"),
"https": require.resolve("https-browserify"),
"http": require.resolve("stream-http"),
"zlib": require.resolve("browserify-zlib"),
"path": require.resolve("path-browserify"),
"process": require.resolve("process/browser") // Ensure process is polyfilled
},
},
externals: {
jquery: 'jQuery' // This will reference the global jQuery object
},
plugins: [
// Generate the HTML index page based on our template.
// This will output the same index page with the bundle we
// created above added in a script tag.
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
new HtmlWebpackPlugin({
template: 'src/index.html',
}),
],
};