问题描述
我认为通过导出特定的函数并使用它,它将仅将此函数包括在编译文件中,但似乎并不像以前那样:
文件1:
export function redu1(state = null, action) {
return state;
}
export function redu2(state = null, action) {
return state;
}
文件2:
import {redu1} from './file1';
我在编译文件中看到所有功能都包括在内了吗?
1楼
Arif
0
2019-02-21 12:40:05
根据 ,您应该在webpack.config.js文件中将属性mode
设置为production
,以从包中删除无效代码。
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
mode: 'production'
};