-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (67 loc) · 1.51 KB
/
webpack.config.js
File metadata and controls
69 lines (67 loc) · 1.51 KB
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
const path = require('path');
const ESLintPlugin = require('eslint-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin');
const getConfig = (entryFile, outputFile) => ({
context: __dirname,
mode: 'production',
entry: entryFile,
output: {
path: path.resolve(__dirname, 'workers'),
filename: outputFile,
globalObject: 'this',
library: {
name: 'gql-grammar-worker',
type: 'umd',
},
},
resolve: {
extensions: ['.ts', '.js', '.json'],
plugins: [new TsconfigPathsPlugin()],
symlinks: false,
},
module: {
rules: [
{
test: /\.[tj]s$/,
use: [
{
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
},
},
],
exclude: /node_modules/,
},
],
},
plugins: [new ESLintPlugin()],
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
parse: {
ecma: 8,
},
compress: {
ecma: 5,
warnings: false,
comparisons: false,
},
mangle: {
safari10: true,
},
output: {
ecma: 5,
comments: false,
ascii_only: true,
},
},
parallel: true,
}),
],
},
});
module.exports = [getConfig('./src/workers/sparql/worker.ts', 'sparql.worker.js')];