-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
82 lines (79 loc) · 2.08 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
aframe: './src/aframe-scene.js',
tutorial: './src/tutorial-scene.js',
quizz: './src/quizz-scene.js',
gallery: './src/gallery-scene.js',
presentation: './src/reveal-presentation.js',
voteAggregator: './src/vote-aggregator.js'
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
new CopyWebpackPlugin({
patterns: [
{ from: 'public', to: '' }
],
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
}),
new webpack.NormalModuleReplacementPlugin(/node:/, (resource) => {
const mod = resource.request.replace(/^node:/, "");
switch (mod) {
case "path":
resource.request = "path-browserify";
break;
case "url":
resource.request = "url/";
break;
default:
throw new Error(`Not found ${mod}`);
}
}),
],
resolve: {
fallback: {
"fs" : false,
"ws": false,
"url": require.resolve("url/"),
"net": false,
"tls": false,
"path": require.resolve("path-browserify"),
"zlib": require.resolve("browserify-zlib"),
"stream": require.resolve("stream-browserify"),
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"crypto": require.resolve("crypto-browserify"),
"buffer": require.resolve("buffer/")
},
alias: {
'@cmcrobotics/homie-lit': '@cmcrobotics/homie-lit'
},
mainFields: ['module', 'browser', 'main']
},
devServer: {
static: {
directory: path.join(__dirname, 'public'),
},
compress: true,
port: 9000,
}
};