在我的webpack配置文件中,我有以下配置:
var path = require('path');
var webpack = require('webpack');
var base = path.join(__dirname);
var vendors = [
'antd',
'autobind-decorator',
'babel-polyfill',
'classnames',
'moment',
'rc-select',
'react',
'react-bootstrap',
'react-bootstrap-validation',
'react-datetime',
'react-dom',
'react-mixin',
'react-router',
'reflux',
'reqwest',
'tiny-cookie'
];
module.exports = {
cache: true,
devtool: 'cheap-module-source-map',
output: {
path: `${base}/dist`,
library: '[name]_[chunkhash]',
filename: '[name].bundle.js',
},
entry: {
vendor: vendors,
},
plugins: [
new webpack.DllPlugin({
path: 'manifest.json',
name: '[name]_[chunkhash]',
context: __dirname,
}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
except: ['$super', '$', 'exports', 'require']
}),
],
};
在我的jsx中,我知道:
import {Icon} from antd;
但是在这里我想将供应商编译成webpack dll,所以我只想导入一些antd的组件,而不是整个模块。我该怎么办?