Skip to content

Import WASM using webpack #763

Closed
Closed
@greenpdx

Description

@greenpdx

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions