vite-plugin-rsw: Cannot get it to work with build

It runs perfectly on dev but after I build my project I always get the error in the browser:

TypeError: Failed to construct 'URL': Invalid URL

Tracking it back to the generated .js file where the init() method relies on import.meta.url to construct the url of the wasm file. But that doesn’t seem to be available after building.

Interestingly I get the exact same issue when I build your Vue 3 example.

Is there something I’m missing?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@audacioustux This has not yet been achieved, can be included in the plan, please stay tuned to the project.

@audacioustux Please install version v1.3.1, rust crates supports custom paths, you can use relative or absolute paths.

https://github.com/lencx/vite-plugin-rsw/issues/3#issuecomment-818820824

The path that meets the agreement will be automatically matched inside the plug-in, that is, the package name in the crate is equivalent to the folder name under the root path.