openimsdk / open-im-sdk-web-wasm

JS SDK for OpenIM Web use by Webassembly of go
https://openim.io
Apache License 2.0
29 stars 37 forks source link

in vue2.0 with webpack4 error : Module parse failed: Unexpected token (112:50) File was processed with these loaders: * ./node_modules/cache-loader/dist/cjs.js * ./node_modules/babel-loader/lib/index.js #65

Closed 327674413 closed 9 months ago

327674413 commented 9 months ago

What happened?

I want to use it in my project. My project base on this source: https://github.com/PanJiaChen/vue-admin-template I use open-im-sdk-web-wasm step: 1、npm install open-im-sdk-wasm

2、copy node_modules open-im-sdk-wasm to public dir

3、edit "index.html" file add

4、npm install worker-loader worker-plugin -D

5、edit "vue.config.js" file , add code plugins:[ new WorkerPlugin() ] in configureWebpack attr

and add code "const WorkerPlugin = require("worker-plugin")"

6、edit " lib/api/index.js " file, use webpack4 import

7、copy "lib" to my project src/utils and rename open-im-sdk-wasm

8、 when I use it "import { getSDK } from "@/utils/open-im-sdk-wasm" ,report error: in ./src/utils/open-im-sdk-wasm/sdk/index.js

Module parse failed: Unexpected token (112:50) File was processed with these loaders:

What did you expect to happen?

i want use this sdk in my old project

How can we reproduce it (as minimally and precisely as possible)?

can use https://github.com/PanJiaChen/vue-admin-template to install and use this sdk

Anything else we need to know?

No response

version

node:12.22.12 npm:6.14.16 vue-admin-template@4.2.1 /Users/yelin/vue/vue-admin-dandan ├─┬ @vue/cli-plugin-babel@3.6.0 │ └── webpack@4.28.4 ├─┬ @vue/cli-plugin-eslint@3.12.1 │ └── webpack@4.46.0 └─┬ @vue/cli-service@4.5.19 └── webpack@4.46.0 deduped

Cloud provider

none

OS version

No response

Install tools

No response

327674413 commented 9 months ago

i solove it may be use node version 16