-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.yassb.config.ts
More file actions
79 lines (74 loc) · 1.81 KB
/
Copy pathwebpack.yassb.config.ts
File metadata and controls
79 lines (74 loc) · 1.81 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
70
71
72
73
74
75
76
77
78
79
import { readJSONSync } from 'fs-extra';
import { join } from 'path';
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
import * as webpack from 'webpack';
import { DefinitionsBundler } from './definitions-bundler.plugin';
const DoneWebpackPlugin = require('done-webpack-plugin');
const packageConfig = readJSONSync('./package.json', { encoding: 'utf-8' });
const externals = {};
for (const packageName in packageConfig.dependencies)
externals[packageName] = packageName;
for (const packageName in packageConfig.devDependencies)
externals[packageName] = packageName;
const yassbConfig: webpack.Configuration = {
entry: {
index: './src/index.ts'
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
plugins: [
new TsconfigPathsPlugin({ configFile: "./tsconfig.json", logLevel: 'INFO' }) as any
]
},
plugins: [
new DoneWebpackPlugin(() => {
new DefinitionsBundler().process();
})
],
target: 'node16',
node: {
__dirname: false
},
externals,
output: {
path: join(__dirname, 'bundle'),
filename: '[name].js',
library: 'YASSB',
libraryTarget: 'umd',
umdNamedDefine: true,
globalObject: 'this'
},
module: {
rules: [
{
test: /\.html$/,
loader: 'html-loader',
options: {
minimize: false
}
},
{
test: /\.scss$|\.txt$/i,
loader: 'raw-loader',
options: {
esModule: false,
}
},
{
test: /\.ts$|\.tsx$/,
loader: 'ts-loader',
options: {
configFile: 'tsconfig.json',
happyPackMode: true
}
}
]
},
mode: 'production',
optimization: {
minimize: false
}
};
// tslint:disable-next-line:no-default-export
export default [yassbConfig];