steal-tools icon indicating copy to clipboard operation
steal-tools copied to clipboard

Slim loader relative bundle paths

Open m-mujica opened this issue 7 years ago • 7 comments

steal-tools writes out config like these to progressive load bundles:

global.steal.paths = {
  "316": "dist/bundles/bitballs/index.js",
  "317": "dist/bundles/bitballs/index.css",
  "318": "dist/bundles/404-component-de-b096d349.js",
  "319": "dist/bundles/details-details--87019b0a.js"
};

One thing I found is that, the code to load the bundles break when the url is other that root, because the paths are relative. Two options come to mind to fix this:

a) Make it so steal-tools writes out absolute paths b) Change the loader so it adds / to the start of the path.

I like a) because that means we won't have to adjust plugins (like css) to deal with the relative paths, but I'm not 100% sure that's the right™ solution.

Thoughts @matthewp?

m-mujica avatar Jan 26 '18 23:01 m-mujica

Does it work if you use the tag?

matthewp avatar Jan 27 '18 00:01 matthewp

The base tag

matthewp avatar Jan 27 '18 00:01 matthewp

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base

matthewp avatar Jan 27 '18 00:01 matthewp

It does work, but I had to add the <base href="/"> to the index.stache used as main.

done-autorender removes it from the head if I make the loader inject the tag (or if I add the tag to my prod.html page)

Is it ok to ask users to add the base tag if they run into issues or should we make it automagic somehow?

m-mujica avatar Jan 29 '18 17:01 m-mujica

steal.production.js has the same issue. I'm not sure... is it automagic there some how? I don't think that it is...

matthewp avatar Jan 29 '18 18:01 matthewp

@m-mujica Didn't you fix this?

matthewp avatar Jul 11 '18 12:07 matthewp

@matthewp I don't think so. I did work in a bundle path issue but it was about css bundles with custom dest https://github.com/stealjs/steal-tools/pull/1000

m-mujica avatar Jul 11 '18 15:07 m-mujica