rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Bug]: something was wrong ,see the picture

Open TryChai opened this issue 1 year ago • 2 comments

Version

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 5.97 GB / 15.66 GB
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.1202

Details

image Panic occurred at runtime. Please file an issue on GitHub with the backtrace below: https://github.com/web-infra-dev/rspack/issues Message: The export "clearGlobal" in "./node_modules/@visactor/vtable/es/index.d.ts" has no internal name (existing names: ) Location: crates\rspack_core\src\concatenated_module.rs:1778

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering. Run with RUST_BACKTRACE=full to include source snippets. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1: napi_register_module_v1 at 2: napi_register_module_v1 at 3: napi_register_module_v1 at 4: napi_register_module_v1 at 5: wasmer_vm_f64_nearest at 6: napi_register_module_v1 at 7: napi_register_module_v1 at

Reproduce link

no link

Reproduce Steps

run build

TryChai avatar Jul 31 '24 08:07 TryChai

Hello @TryChai, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

github-actions[bot] avatar Jul 31 '24 08:07 github-actions[bot]

Why importing value from dts file

JSerFeng avatar Aug 09 '24 09:08 JSerFeng

Since the issue was labeled with need reproduction, but no response in 14 days. This issue will be closed. Feel free to comment and reopen it if you have any further questions.

github-actions[bot] avatar Aug 28 '24 00:08 github-actions[bot]

@JSerFeng I got the same issue, It can stable reproduce when run in CI while using DefinePlugin to define an object global variable and read in source code.

The CI system:

  • Linux version 5.4.143.bsk.7-amd64 (gcc version 8.3.0 (Debian 8.3.0-6))

But it cannot reproduce on Mac.

See like:

The config is:

const config = {
   plugin: [
      new DefinePlugin({
           BUILD_INFO: {
                faker_field_a: "",
                faker_field_b: "",                
           }
      })
   ]
}

The file a.ts:

export function a() {
  const test_field = BUILD_INFO?.faker_field_a;

  return {}
}

The entry file index.ts:

import { a } from './a'; // <- throw error: The export "a" in "./a.ts" has no internal name (existing names: )

a();

I will try to create a minimum reproduce sandbox for you.

Justinidlerz avatar Aug 29 '24 04:08 Justinidlerz

I used a third-party plugin and I got this error when packing, I didn't have this problem with vite packaging, but I migrated to rsbuild and had this problem

TryChai avatar Aug 31 '24 09:08 TryChai

Try use bail, see if something wrong in make phase

module.exports = { bail: true }

JSerFeng avatar Sep 02 '24 06:09 JSerFeng

Since the issue was labeled with need reproduction, but no response in 14 days. This issue will be closed. Feel free to comment and reopen it if you have any further questions.

github-actions[bot] avatar Sep 17 '24 00:09 github-actions[bot]

For those who have the same problem.

When using DefinePlugin, better to use string instead of object for the value.

new DefinePlugin({
  'process.env': {
    foo: 'a',
    bar: 'b'
  }
})

// use following instead
new DefinePlugin({
  'process.env.foo': JSON.stringify('a'),
  'process.env.bar': JSON.stringify('b')
})

ghost avatar Sep 25 '24 03:09 ghost