-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
72 lines (66 loc) · 2.05 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
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
// We have two entry points.
// One for our UI client and one
// for the AUX Virtual Machine.
entry: {
// This is our UI entry point.
app: './src/index.ts',
// This is the entry point for the AUX VM.
// AUX uses a sandboxed iframe along with a web worker
// to provide performance and isolation from
// the main thread. This is what allows
// multiple simulations to be running at the same time.
vm: path.resolve(
__dirname,
'node_modules',
'@casual-simulation',
'aux-vm-browser',
'html',
'IframeEntry.js'
),
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
module: {
// Rules for TypeScript
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
devServer: {
contentBase: './dist',
},
plugins: [
new CleanWebpackPlugin(),
// Here, we use the HtmlWebpackPlugin to generate
// the output HTML that gets served to the web browsers.
// We have one for our UI and one for the AUX VM.
new HtmlWebpackPlugin({
// Specify that we only want the "app" chunk
// included in the output HTML
chunks: ['app'],
template: path.resolve(__dirname, 'src', 'index.html'),
}),
new HtmlWebpackPlugin({
// Specify that we only want the "vm" chunk included
// in the output HTML.
chunks: ['vm'],
title: 'AUX VM',
// The AUX VM will load a file named
// aux-vm-iframe.html
filename: 'aux-vm-iframe.html',
}),
],
};