Skip to content
This repository has been archived by the owner on Jul 18, 2019. It is now read-only.

publicPath option #9

Closed
Rich-Harris opened this issue Aug 25, 2018 · 2 comments
Closed

publicPath option #9

Rich-Harris opened this issue Aug 25, 2018 · 2 comments

Comments

@Rich-Harris
Copy link
Contributor

I'm working on adding Rollup support to Sapper. Since Firefox doesn't yet support import() (and IE11 never will), and until you can use modules in workers, the plan is to use loadz0r.

There's a wrinkle: loadz0r loads modules like this...

script.src = './chunk-xyz123.js'

...but that URL is resolved relative to the page, not the importer. So if you have your scripts in a folder, or you're on a page other than /, the request fails.

Webpack solves this with options.publicPath. Rollup could do the same, but since it doesn't (normally) bundle a loader, perhaps it makes sense to implement that option here? In Sapper's case it would look like this:

loadz0r({
  publicPath: 'client'
})

I'm not immediately sure what the most sensible approach is, but let me know if this is something you'd accept a PR for. Thanks!

@Rich-Harris
Copy link
Contributor Author

(Oh, forgot to mention: I made a lil' repro: https://github.com/Rich-Harris/rollup-plugin-loadz0r-issue-repro)

@surma
Copy link
Owner

surma commented Aug 25, 2018

I think an option is the right way to go here. The only requirement I set for loadz0r is to not have path resolution logic in the loader. Very happy to accept a PR, otherwise I’ll whip something up next week :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants