Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining publicUrl with asset path gives incorrent URL #20

Closed
akim-bow opened this issue Aug 23, 2023 · 3 comments
Closed

Combining publicUrl with asset path gives incorrent URL #20

akim-bow opened this issue Aug 23, 2023 · 3 comments

Comments

@akim-bow
Copy link

akim-bow commented Aug 23, 2023

This setup

libAssetsPlugin({
    include: ['**/*.wasm*'],
    publicUrl: 'https://unpkg.com/'
})

And import
import wasmDep from './assets/dep.wasm'
Gives you
const wasmDep = 'https:/unpkg.com/assets/dep.wasm'

Which is incorrect URL and will work unexpectedly at runtime.

@akim-bow akim-bow changed the title Combining publicUrl with asset path gives you incorrent URL Combining publicUrl with asset path gives incorrent URL Aug 23, 2023
@akim-bow
Copy link
Author

akim-bow commented Aug 23, 2023

Tested on 0.5.1.
Probably it's because of this line

return `export default '${path.posix.join(publicUrl, assetPath)}'`

Not a good idea to use path.join for url's

@coder-layne
Copy link
Contributor

Tested on 0.5.1. Probably it's because of this line

return `export default '${path.posix.join(publicUrl, assetPath)}'`

Not a good idea to use path.join for url's

Thank you for your feedback. You're correct, I'll address this in v0.5.2.

@coder-layne
Copy link
Contributor

I just released v0.5.2. You can try it out.

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

No branches or pull requests

2 participants