-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.mjs
62 lines (58 loc) · 1.38 KB
/
webpack.config.mjs
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
import path from 'path';
import terserPlugin from 'terser-webpack-plugin';
import { fileURLToPath } from 'url';
const config = {
entry: './src/index.js',
mode: 'production',
optimization: {
minimize: true,
minimizer: [new terserPlugin({ extractComments: false })]
},
performance: {
hints: false
}
};
const standalone_config = {
...config,
devServer: {
static: {
directory: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'public')
},
port: 8080,
/**
* Used in order to run fight.swf with Ruffle.
* The SWF expects /user/check to return 'OK' in order to load.
* @param {object} middlewares Middlewares of the development server.
* @param {object} server Development server.
* @returns {object} The middlewars for chaining.
*/
setupMiddlewares: (middlewares, server) => {
server.app.post('/user/check', (_req, res) => {
res.send('OK');
});
return middlewares;
}
},
output: {
filename: 'dinorpg-animations-test.min.js',
path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'public'),
library: {
name: 'DinoAnim',
type: 'umd'
}
}
};
const esm_config = {
...config,
output: {
filename: 'dinorpg-animations.min.js',
path: path.resolve(path.dirname(fileURLToPath(import.meta.url)), 'dist'),
library: {
type: 'module'
}
},
experiments: {
outputModule: true
}
};
export default [standalone_config];