Menci / vite-plugin-wasm

Add WebAssembly ESM integration (aka. Webpack's `asyncWebAssembly`) to Vite and support `wasm-pack` generated modules.
MIT License
281 stars 16 forks source link

Uncaught (in promise) SyntaxError: Unexpected reserved word #20

Closed xzxzhixin closed 1 year ago

xzxzhixin commented 1 year ago

image image image 报错Uncaught (in promise) SyntaxError: Unexpected reserved word image 在webpack5中是正常的,使用的rust构建命令是:wasm-pack build --target bundler

katopz commented 1 year ago

I think to use import there it should be <script type="module">.

Menci commented 1 year ago

reproduce project pls

xzxzhixin commented 1 year ago

https://gitee.com/zhi_xin_qiantong/vue2-learning 我的项目地址 image image

xzxzhixin commented 1 year ago

I think to use import there it should be <script type="module">.

这个没有用,还是一样的错误

Menci commented 1 year ago
image

Can't reproduce it.

xzxzhixin commented 1 year ago
image

Can't reproduce it.

在低版本谷歌内核中有问题,这个低版本谷歌内核是360浏览器 image 高版本中谷歌就没有这个问题,这个高版本是谷歌浏览器 image

Menci commented 1 year ago

I reviewed your screenshot and realized that it's in dev mode.

image

You shouldn't use a non-latest browser for dev mode. Vite doesn't support legacy / outdated browsers in dev mode. Even if you want your app to support outdated / legacy browsers, you should dev in latest browsers and test the built bundle in your target browsers.

Please test if the built bundle (with yarn vite build) works in your outdated browser.