rspack: [Bug Report]: JS evaluation fails when importing from three.js
System Info
System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 1.91 GB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.0/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm Watchman: 2023.01.16.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 110.0.5481.177 Safari: 16.2 npmPackages: @rspack/cli: ^0.1.0 => 0.1.0 @rspack/dev-server: ^0.1.0 => 0.1.0
Details
If importing anything from @react-three/drei
, there is a JS evaluation error when bundle is being evaluated. E.g. just import this
import { Environment } from '@react-three/drei'
export const x = <Environment preset="city" />
You can see the versions below. This works fine with webpack with swc-loader, which is our current bundler.
Reproduce link
https://github.com/marco2216/rspack-chevrotain
Reproduce Steps
Import anything that includes the chevrotain module, I guess?
import { Environment } from '@react-three/drei'
export const x = <Environment preset="city" />
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16
The mjs import other js has two mode, like this. Because swc mode(fix #2433) is common used than node mode(fix #2190), so i decide revert pervious change. The compat can be fixed at custom runtime, not depend on swc commonjs transform.
As @towavephone You can use this as a workaround.