webpack-contrib / bundle-loader

Bundle Loader
MIT License
658 stars 59 forks source link

named export is `undefined` #53

Open sam-rad opened 7 years ago

sam-rad commented 7 years ago

When using loader's syntax I get undefined for named exports:

// Comey.js
const Dismissed = () => <div> :| </div>
const Career = () => <div> ;| </div>

export {
  Dismissed as default,
  Career
};

// main.js
import Dismissed, { Career } from 'bundle-loader?lazy!./Comey';

console.log(Dismissed); //  function (cb) { blah }
console.log(Career);  // `undefined`

// - "webpack":       "2.4.1",
// - "bundle-loader": "0.5.5",
michael-ciniawsky commented 7 years ago

@snikobonyadrad Also when using require() ?

sam-rad commented 7 years ago

Yes sir:

var Dismissed = require('bundle-loader?lazy!./Comey');

console.log(Dismissed);        // [function]
console.log(Dismissed.Career); // `undefined`

// versus

var Dismissed = require('./Comey');

console.log(Dismissed);        // [function]
console.log(Dismissed.Career); // [function]
michael-ciniawsky commented 7 years ago

Your webpack.config.js and ideally a small test repo please :)

sam-rad commented 7 years ago

Here you go webpack-bundle-loader-bug. If you have cloud9 account I can give you access there too. Thanks.