forked from jpcy/xatlas
-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
55 lines (51 loc) · 1.44 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
const webpack = require("webpack");
const path = require("path");
const SRC_PATH = path.resolve(__dirname, 'source', 'web');
const NODE_MOD_PATH = path.resolve(__dirname, 'node_modules');
const BUILD_PATH = path.resolve(__dirname, 'dist');
const BUILD_FILE_NAME = 'xatlas';
const LIBRARY_NAME = 'XAtlas';
const LIBRARY_TARGET = 'self';
// const MODE = "development"
const MODE = "production"
const entry = {
};
entry[BUILD_FILE_NAME] = path.join(SRC_PATH, 'index.js');
module.exports = {
mode: MODE,
devtool: 'source-map',
entry: entry,
output: {
filename: '[name].js',
path: BUILD_PATH,
library: LIBRARY_NAME,
libraryTarget: LIBRARY_TARGET,
globalObject: 'this',
},
// This is necessary due to the fact that emscripten puts both Node and web
// code into one file. The node part uses Node’s `fs` module to load the wasm
// file.
// Issue: https://github.com/kripken/emscripten/issues/6542.
node: {
fs: "empty"
},
resolve: {
modules: [SRC_PATH, NODE_MOD_PATH],
},
module: {
rules: [
{
test: /\.worker\.js/,
use: {
loader: "worker-loader",
options: { fallback: true }
}
},
{
test: /\.wasm$/,
type: 'javascript/auto',
loader: 'file-loader',
}
]
},
};