forked from tentone/nunuStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.runtime.js
66 lines (63 loc) · 1.5 KB
/
webpack.runtime.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 Path = require("path");
const Webpack = require("webpack");
const source = Path.resolve(__dirname, "source");
const output = Path.resolve(__dirname, "dist");
const config = {
context: source,
entry: source + "/core/Main.js",
target: "web",
devtool: "none",
mode: "production",
optimization: {minimize: true},
plugins: [
new Webpack.ProvidePlugin({
THREE: "three",
"window.THREE": "three"
})
],
module: {
rules: [
{
test: /\.glsl$/i,
use: "raw-loader"
},
{
test: /.*spine-threejs.*/,
loader: "@shoutem/webpack-prepend-append",
query: "{\"append\": \"export {spine};\"}"
},
{
test: /.*brython.*/,
loader: "@shoutem/webpack-prepend-append",
query: JSON.stringify({
prepend: `(function (root, factory) {
if (typeof define === 'function' && define.amd) { define([], factory); } // AMD loader
else if (typeof module === 'object' && module.exports) { module.exports = factory(); } // CommonJS loader
else { root.brython = factory(); } // Script tag
}(typeof self !== 'undefined' ? self : this, function () {
var process = {release: {name: ''}};`,
append: `window.__BRYTHON__ = __BRYTHON__;
return __BRYTHON__;
}));`
})
}
]
}
};
module.exports = [
Object.assign({
output: {
filename: "nunu.min.js",
path: output,
library: "Nunu",
libraryTarget: "umd"
}
}, config),
Object.assign({
output: {
filename: "nunu.module.min.js",
path: output,
libraryTarget: "umd"
}
}, config)
];