-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-sdk.common-config.js
58 lines (56 loc) · 1.62 KB
/
webpack-sdk.common-config.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
const path = require('path')
const webpack = require('webpack')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const resolve = dir => path.resolve(__dirname, dir)
const resolveArr = dirs => dirs.map(dir => resolve(dir))
module.exports = {
entry: {
main: './sdk/src/index.js'
// polyfill: ['babel-polyfill'],
// vendor: ['locale', 'locale2', 'vue-i18n', 'i18n-iso-countries', 'qs', 'axios', 'element-ui', 'mo-vue-table', 'lodash.debounce', 'lodash.zip', 'lodash.unzip', 'lodash.reduce']
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
include: resolve('components'),
exclude: /(node_modules)/,
options: {
loaders: {
'scss': 'vue-style-loader!css-loader!sass-loader'
}
}
},
{
test: /\.js$/,
include: [resolveArr(['components', 'lib', 'plugins', 'config', 'store', 'sdk/src'])],
exclude: /node_modules/,
use: ['babel-loader', 'eslint-loader']
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader'
}
]
},
plugins: [
new CleanWebpackPlugin(['sdk-dist']),
new webpack.NormalModuleReplacementPlugin(/element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-ui/lib/locale/lang/en')
],
output: {
path: path.resolve(__dirname, './sdk-dist'),
filename: 'sdk.js'
}
}