montagejs / mop

Montage Optimizer (mop): Minifies (to reduce file size) and creates bundles (to reduce the number of requests) of Montage applications.
Other
31 stars 16 forks source link

Fix bundling of entry HTML files beneath the project root #49

Closed kriskowal closed 10 years ago

Stuk commented 10 years ago

Code looks fine. Seem like this is slightly awkward to test...

Stuk commented 10 years ago

@kriskowal could you expand on the problem this fixes?

kriskowal commented 10 years ago

An “entry page” is a file that has a <script> that loads either the Montage or Mr bootstrap script. This script gets transformed into a bootstrapping bundle, including the transitive dependencies of the root component. There may be subsequent preload bundles. The preload bundles must end with a call to bundleLoaded with their own file name, relative to the entry page. However, before these changes, the given name is relative to the project root.

Currently, all entry pages that are in the root directory of a project, those in the same directory as the package.json, work fine, but this is just by coincidence. If the entry page is in a subdirectory, the preloader is never made aware when the preloading bundles are finished executing.

Stuk commented 10 years ago

I've verified this fix locally and written a mop-integration test, but it's not running at the moment because of a problem with the url2 module.

kriskowal commented 10 years ago

I’ll have a fix for https://github.com/kriskowal/url2/issues/3 soon.