This repository was archived by the owner on Jan 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.js
More file actions
96 lines (94 loc) · 2.96 KB
/
Copy pathwebpack.config.js
File metadata and controls
96 lines (94 loc) · 2.96 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const DtsBundleWebpack = require('dts-bundle-webpack');
var merge = require('webpack-merge');
const libraryName = 'UWT';
let common = {
name: 'component-lib',
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'umd',
library: [libraryName],
filename: 'js/[name].js',
umdNamedDefine: true
},
externals: {
'@angular': '@angular',
d3: 'd3',
'd3-sankey': {
root: 'Sankey',
commonjs2: 'd3-sankey',
amd: 'd3-sankey',
commonjs: 'd3-sankey'
},
dagre: 'dagre',
'es6-promise': 'es6-promise',
'pixi.js': {
root: 'PIXI',
commonjs2: 'pixi.js',
amd: 'pixi.js',
commonjs: 'pixi.js'
},
'ag-grid-community': {
root: 'agGrid',
commonjs2: 'ag-grid-community',
amd: 'ag-grid-community',
commonjs: 'ag-grid-community'
}
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'ts-loader'
},
{
test: /\.worker\.js$/,
use: {
loader: 'worker-loader',
options: { inline: true }
}
}
]
}
}
module.exports = [
merge(common, {
entry: {
'ui-widget-toolkit-graph': path.resolve(__dirname, 'src/build/export.graph.ts'),
'ui-widget-toolkit-chart': path.resolve(__dirname, 'src/build/export.chart.ts'),
'ui-widget-toolkit-grid': path.resolve(__dirname, 'src/build/export.grid.ts'),
'ui-widget-toolkit-decimator-worker': path.resolve(__dirname, 'src/core/cartesian/decimator/worker.ts')
}
}),
merge(common, {
entry: {
'ui-widget-toolkit': path.resolve(__dirname, 'src/index.ts')
},
plugins: [
new DtsBundleWebpack({
name: 'UWT',
main: path.resolve(__dirname, 'types/index.d.ts'),
baseDir: path.resolve(__dirname, 'types'),
out: path.resolve(__dirname, 'dist/index.d.ts'),
removeSource: false,
outputAsModuleFolder: true,
verbose: true
}),
new CopyWebpackPlugin([
{ from: './assets/**/*', to: '.' },
{ from: './css/**/*', to: '.' },
{ from: './package.json', to: '.' },
{ from: './README.md', to: '.' },
{ from: './LICENSE', to: '.' },
{ from: './third-party-programs.txt', to: '.' }
])
]
})
]