-
Notifications
You must be signed in to change notification settings - Fork 73
/
webpack.conf.build.js
87 lines (84 loc) · 2.11 KB
/
webpack.conf.build.js
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
const path = require('path')
const babelConfig = require('./babel.conf.js')
function factory(vendor) {
return {
mode: 'none',
entry: `./vendor/${vendor}/index`,
output: {
path: path.resolve(__dirname, 'dist'),
filename: `numeric_keyboard.${vendor}.js`,
library: 'NumericKeyboard',
libraryTarget: 'umd2',
umdNamedDefine: true
},
resolve: {
alias: {
lib: path.resolve(__dirname, './lib')
},
extensions: ['.ts', '.js']
},
externals: {
'vue': {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
},
'react': {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
},
'@angular/core': {
root: 'ng',
commonjs2: '@angular/core',
commonjs: '@angular/core',
amd: '@angular/core'
},
'@angular/common': {
root: 'ng',
commonjs2: '@angular/common',
commonjs: '@angular/common',
amd: '@angular/common'
}
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules|dist/,
use: ['awesome-typescript-loader', 'angular2-template-loader']
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [{ loader: 'babel-loader', options: babelConfig(vendor) }, 'eslint-loader']
},
{
test: /\.component.styl$/,
exclude: /node_modules/,
use: ['to-string-loader', 'css-loader', 'stylus-loader']
},
{
test: /\/\w+(?!\.component\.)\.styl$/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader', 'stylus-loader']
},
{
test: /\.woff$/,
exclude: /node_modules/,
use: ['url-loader']
}
]
},
devtool: false
}
}
module.exports = ['vanilla', 'react', 'vue', 'angular'].map(vendor => factory(vendor))