-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Import WASM using webpack #763
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
Remove the |
I did that and now I get webpack errors WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
npm ERR! A complete log of this run can be found in: |
Well your Loaders need to declared in |
I am sorry but my webpack knowledge is limited. What is the correct webpack.config? I got it working by editing node_modules/@vue/cli-service/lib/config/base.js What do I add to vue.config.js and where do I add it? There are two section |
module.exports = {
chainWebpack: webpackConfig => {
webpackConfig.module
.rule('wasm')
.test(/.wasm$/)
.use('wasm-loader')
.loader('wasm-loader')
}
} |
thanks that worked, |
Facing a similar problem,
using the above I am able to log the function imported from wasm but while calling the function BTW I am trying with the |
Version
3.0.0-alpha.5
Reproduction link
https://github.com/greenpdx/rustwasm
Steps to reproduce
npm install
npm run server
What is expected?
I expect webpack to load the wasm file
I am using https://github.com/ballercat/wasm-loader
In vue.config.js I have added the suggested loader config for wasm-loader. But cache-loader is still trying to load WASM file
What is actually happening?
94% asset optimization
ERROR Failed to compile with 1 errors 18:35:40
error in ./src/tst.wasm
Module parse failed: Unexpected character '' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/home/ubuntu/newvue/node_modules/.cache/cache-loader"}!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/HelloWorld.vue 18:0-30
@ ./src/components/HelloWorld.vue
@ ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/home/ubuntu/newvue/node_modules/.cache/cache-loader"}!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080/ (webpack)/hot/dev-server.js ./src/main.js
This is my first try using version 3. My finial goal is to load cv.js which is opencv 3.1.0 compiled to wasm. But I run out of memory importing 'cv'.
I am starting with a small example first.
The text was updated successfully, but these errors were encountered: