-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bundle
- Panic on arrays with 64 or more numbers
#5891
Comments
You can reproduce the panic by adding a test-case in diff --git a/node-swc/__tests__/spack/simple_test.js b/node-swc/__tests__/spack/simple_test.js
index ca041a6f9c..26b072476c 100644
--- a/node-swc/__tests__/spack/simple_test.js
b/node-swc/__tests__/spack/simple_test.js
@@ -35,4 35,17 @@ it('should handle loader', async () => {
console.log(result)
expect(result.simple).toBeTruthy();
expect(result.simple.code.replace('\n', '')).toBe(`console.log("Foo");`);
});
it('should handle arrays', async () => {
const result = await swc.bundle({
name: 'array',
entry: {
array: path.join(__dirname, '../../tests/spack/array/a.js')
},
});
console.log(result)
expect(result.array).toBeTruthy();
expect(result.array.code.replace('\n', '')).toBe('');
});
\ No newline at end of file
diff --git a/node-swc/tests/spack/array/a.js b/node-swc/tests/spack/array/a.js
new file mode 100644
index 0000000000..2236dcd59d
--- /dev/null
b/node-swc/tests/spack/array/a.js
@@ -0,0 1,18 @@
const foo = [
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
1, 1, 1, 1,
];
\ No newline at end of file Then run the Running a repro with tracing
|
It does the same with an object with at least 8 keys :
In a docker container using Works fine using |
Same issue here: Did you manage to make it work ? |
Describe the bug
When an input file for
@swc/core
'sbundle()
contains a declaration of an array with 64 or more numbers,bundle
panics.Input code
Config
Playground link
No response
Expected behavior
This should emit an empty file or a file that only contains this array.
Actual behavior
bundle
panics:With RUST_BACKTRACE=full
Version
1.3.1
Additional context
I reported this initially in swc-project/cli#163 but I realized the issue is in the
bundle
function which is in this repository.Bundling
foo.js
withdeno bundle foo.js
and compiling it withnpx swc foo.js
works fine.The text was updated successfully, but these errors were encountered: