forked from huanz/tableExport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (44 loc) · 1.1 KB
/
webpack.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
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
/**
* @desc 获取需要剔除的模块
*/
let blocks = [];
let modules = ['json', 'txt', 'csv', 'xml', 'doc', 'xls', 'image', 'pdf'];
if (process.env['MODULES']) {
process.env['MODULES'].split(' ').forEach(m => {
let index = modules.indexOf(m);
if (index !== -1) {
modules.splice(index, 1);
}
});
blocks = modules;
}
module.exports = {
entry: './src/index.js',
output: {
libraryTarget: 'umd',
library: 'tableExport',
path: path.join(__dirname, 'dist'),
filename: 'tableExport.js'
},
module: {
rules: [{
test: /\.js$/,
enforce: 'pre',
exclude: /(node_modules|bower_components|\.spec\.js)/,
use: [{
loader: 'webpack-strip-block',
options: {
blocks: blocks
}
}]
}],
},
devServer: {
contentBase: path.join(__dirname, 'demo'),
compress: true,
port: 3000
}
};