-
Notifications
You must be signed in to change notification settings - Fork 12k
[WASM] Module not found: Error: Can't resolve #14987
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
Comments
@suyoshi currently to apply custom webpack config using ngx-build-plus. |
Webpack adds in the |
It's true that Webpack adds the In fact we do our best to keep anything that is webpack-specific away from project source-code, because at some point in the future we might decide to change our build system. Is it problematic to just import |
And what about a library which internally uses WebAssembly and imports it without the This is a common use case, there are already several npm libraries which internally use WebAssembly to speed up their internal algorithms, and the usage of WebAssembly will only go up over time. You cannot expect all library authors to explicitly import |
I think you're giving Webpack a bit too much importance in this topic. Webpack is very popular, but that doesn't mean everyone uses Webpack. For instance, a lot of toolchains use Rollup instead. The WASM rollup plugin shows an example of importing a If you have a library and you package it in a way that assumes Webpack, then you are limiting how consumers can use your library. The limitations are both that consumers must use webpack, and that webpack must be configured in a certain way to use the library. This is a serious limitation because it gets passed on transitively to both your direct and indirect consumers. A user might not use a library directly and still run into these problems because of an indirect dependency. The specific case of changing the an extension resolver also has performance implications. That's the list of extensions the resolver will try to load before it gives up on loading a file. So each extension added there increases total file system operations by a factor relative to its position in the priority array. In Webpack's case, I'm sure Webpack has great reasons for listing If importing If you have a library that assumes the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Description
wasm-pack creates a bundle which ends up doing this:
import * as wasm from './my_wasm'
(my_wasm
is in realitymy_wasm.wasm
, notice the absence of the.wasm
extension.)When I import the package in my angular project I get the following error during
ng build
:Module not found: Error: Can't resolve './my_wasm' in 'my_package'
.While it is supposed to work with Webpack. As far as I can tell one solution is to add
resolve.extensions: ['.wasm']
to the webpack configuration, but Angular doesn't expose that option.🌍 Your Environment
Angular Version:
8.0.3
Anything else relevant?
The text was updated successfully, but these errors were encountered: