webpack-contrib / bundle-loader

Bundle Loader
MIT License
658 stars 59 forks source link

Lazily loads bundle multiple times #17

Closed virajsanghvi closed 9 years ago

virajsanghvi commented 9 years ago

I'm not sure if this is expected, but I'm basically doing something like:

let loader = require('bundle?lazy&name=my-chunk!./file.js');

function doSomething() {
  loader(exportedObj => ...do stuff..)
}

I assumed that the first time I called doSomething, it would fetch the bundle, and subsequent calls would used the previously fetched bundle, but it appears a new script tag is placed in each time.

Is this expected?

virajsanghvi commented 9 years ago

Spoke too soon, I was using a variant of this for error handling support (https://github.com/NekR/async-module-loader), and its plugin causes this behavior.