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.framework.js
More file actions
160 lines (158 loc) · 4.68 KB
/
webpack.framework.js
File metadata and controls
160 lines (158 loc) · 4.68 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const DtsBundleWebpack = require('dts-bundle-webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const webpackAngularExternals = require('webpack-angular-externals');
var merge = require('webpack-merge');
let common = {
name: 'framework',
mode: 'development',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'framework/[name]/index.js',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: [
webpackAngularExternals(),
/^ui-widget-toolkit*/,
{
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'
},
vue: 'vue',
'vue-material': 'vue-material',
react: 'React'
}
],
resolve: {
extensions: ['.ts', '.js', 'jsx', '.vue'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'react': 'react',
'@angular': '@angular',
'ui-widget-toolkit': 'ui-widget-toolkit'
}
},
module: {
rules: [
{
test: /\.(jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ['@babel/preset-react']
}
},
{
test: /\.vue?$/,
loader: 'vue-loader',
exclude: /node_modules/
},
{
test: /\.ts?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
appendTsSuffixTo: [/\.vue$/]
}
},
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
]
},
{
test: /\.worker\.js$/,
use: {
loader: 'worker-loader',
options: { inline: true }
}
}
]
}
}
module.exports = [
merge(common, {
entry: {
'angular1': path.resolve(__dirname, 'src/framework/angular1/index.js')
},
output: {
library: ['UWTAngularJS']
}
}),
merge(common, {
entry: {
'vue': path.resolve(__dirname, 'src/framework/vue/index.js')
},
output: {
library: ['UWTVue'],
libraryExport: 'default'
},
plugins: [
// make sure to include the plugin!
new VueLoaderPlugin()
]
}),
merge(common, {
entry: {
'react': path.resolve(__dirname, 'src/framework/react/index.js')
},
output: {
library: ['UWTReact']
}
}),
merge(common, {
entry: {
'angular2': path.resolve(__dirname, 'src/framework/angular2/index.ts')
},
output: {
library: ['UWTAngular']
},
plugins: [
new DtsBundleWebpack({
name: 'UWT',
main: path.resolve(__dirname, 'types/framework/angular2/index.d.ts'),
baseDir: path.resolve(__dirname, 'types'),
out: path.resolve(__dirname, 'dist/framework/angular2/index.d.ts'),
removeSource: false,
outputAsModuleFolder: true,
verbose: true
}),
new CopyWebpackPlugin([
{ from: './src/framework/polymer', to: 'framework/polymer' },
{ from: './src/framework/polymer2', to: 'framework/polymer2' },
{ from: './src/framework/vue/components', to: 'framework/vue//components' },
{ from: './package.json', to: '.' },
{ from: './LICENSE', to: '.' },
{ from: './bower.json', to: '.' },
{ from: './third-party-programs.txt', to: '.' }
])
],
resolve: {
alias: {
'ui-widget-toolkit': path.resolve(__dirname, 'dist/js'),
}
}
})
]