webpack是否总是捆绑整个模块文件?

时间:2017-10-15 09:56:15

标签: webpack

我是webpack的新手,我正在玩它。

现在我使用一个非常简单的配置文件:

'use strict';
const webpack = require('webpack');
const path = require('path');

module.exports = {
  entry: 'app.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js',
  }
};

当我尝试比较输入和输出文件时,我意识到无论我在import WholeModule from './module';中导入整个模块import { doSth } from './module';还是仅导入app.js的某些功能,webpack始终将整个模块文件捆绑到输出文件中。

我可以设置任何webpack配置,使其仅捆绑其他文件使用的功能吗?

0 个答案:

没有答案