-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.ts
79 lines (78 loc) · 1.85 KB
/
webpack.config.ts
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
73
74
75
76
77
78
79
import path from 'path';
import { BannerPlugin } from 'webpack';
import nodeExternals from 'webpack-node-externals';
import CopyPlugin from 'copy-webpack-plugin';
module.exports = {
entry: {
index: {
import: './src/index.ts',
filename: 'index.prod.min.js',
library: {
name: 'java-ts-definition-generator',
type: 'umd',
},
},
cliWorker: {
import: './src/worker/cliWorker.ts',
filename: 'cliWorker.js',
},
cli: {
import: './src/cli.ts',
filename: 'java-ts-gen.js',
},
},
target: 'node16',
mode: 'production',
externalsPresets: {
node: true,
},
externals: [nodeExternals()],
output: {
path: path.join(__dirname, 'dist'),
clean: true,
},
node: {
__dirname: false,
__filename: true,
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.node$/,
loader: 'node-loader',
options: {
name: '[path][name].[ext]',
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
},
devtool: 'source-map',
plugins: [
new BannerPlugin({
banner: '#!/usr/bin/env node',
raw: true,
include: 'java-ts-gen.js',
}),
new CopyPlugin({
patterns: [
{
from: './java-src/build/libs/ASTGenerator-*.jar',
to: 'ASTGenerator.jar',
},
],
}),
],
optimization: {
splitChunks: {
chunks: 'all',
},
},
};