I'm trying to build a js library written in es6 in a bundle. For modules, import / export is used and the preset es2015 Lieb has the following structure.
./src/ Unit1.js Unit2.js ... UnitN.js Entry.js //Точка входа At the entry point I collect exported classes in the namespace.
import A from 'MyLib/Unit1.js' import B from 'MyLib/Unit3.js' import C from 'MyLib/UnitN.js' export default { A: A, B: B, C: C }; webpack config:
{ context: lib_path, entry: './Entry.js', output: { path: `${__dirname}/dist`, filename: 'bundle.js', library: 'MyLib' }, module: { loaders: [{ test: /.js$/, loader: 'babel-loader', query: { presets: ['es2015'] } }] }, resolve: { root: lib_path, alias: { MyLib: './' } } } The problem is the following. I can define the namespace in the webpack config (output.library), but then to refer to the library classes I need to use the constructions MyLib.default.A. I would like to exclude the word default .