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

Emit new URL('...', import.meta.url) for Wasm #2444

Merged
merged 1 commit into from
Feb 4, 2021

Conversation

RReverser
Copy link
Member

@RReverser RReverser commented Feb 4, 2021

Lots of bundlers now support new URL('...path...', import.meta.url) as an explicit signal to specify assets that should be bundled alongside JS.

This is already supported by default in Webpack v5, Parcel v2, Vite, Snowpack and WMR, and available via a plugin - https://modern-web.dev/docs/building/rollup-plugin-import-meta-assets/ - in Rollup as well.

Emitting such pattern by default would allow all those bundlers to automatically include Wasm and generate a correct URL for --target web builds without any work from the user's side.

@alexcrichton
Copy link
Contributor

Seems reasonable to me! I think there's a rustfmt issue though?

Lots of bundlers now support `new URL('...path...', import.meta.url)` as an explicit signal to specify assets that should be bundled alongside JS.

This is already supported by default in Webpack v5, Parcel v2,Vite, Snowpack and WMR, and available via a plugin - https://modern-web.dev/docs/building/rollup-plugin-import-meta-assets/ - in Rollup as well.

Emitting such pattern by default would allow all those bundlers to automatically include Wasm and generate a correct URL for `--target web` builds without any work from the user's side.
@RReverser
Copy link
Member Author

Yeah, sorry about that, formatted & pushed again.

@alexcrichton alexcrichton merged commit de2a5d7 into rustwasm:master Feb 4, 2021
@RReverser RReverser deleted the new-url-import-meta branch February 4, 2021 19:34
@RReverser
Copy link
Member Author

@alexcrichton No rush, but do you have a planned release anytime soon by any chance?

@alexcrichton
Copy link
Contributor

Sure, I've started one at #2468

@RReverser
Copy link
Member Author

Awesome, thank you!

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

Successfully merging this pull request may close these issues.

2 participants