-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Description
Link to the code that reproduces this issue
https://github.com/KentoMoriwaki/turbopack-caniuse-repro
To Reproduce
Clone https://github.com/KentoMoriwaki/turbopack-caniuse-repro and follow README.md
Current vs. Expected behavior
Currently it produces broken bundle. It is expected to produce correct bundle.
before
// with [email protected]
function comment(value, root, parent, siblings) {
return (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Tokenizer$2e$js__$5b$client$5d$__$28$ecmascript$29$__["node"])(value, root, parent, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Enum$2e$js__$5b$client$5d$__$28$ecmascript$29$__["COMMENT"], (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Utility$2e$js__$5b$client$5d$__$28$ecmascript$29$__["from"])((0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Tokenizer$2e$js__$5b$client$5d$__$28$ecmascript$29$__["char"])()), (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Utility$2e$js__$5b$client$5d$__$28$ecmascript$29$__["substr"])(value, 2, -2), 0, siblings);
}
after
// with [email protected]
function comment(value, root, parent, siblings) {
return (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Tokenizer$2e$js__$5b$client$5d$__$28$ecmascript$29$__["node"])(value, root, parent, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Enum$2e$js__$5b$client$5d$__$28$ecmascript$29$__["COMMENT"], (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Utility$2e$js__$5b$client$5d$__$28$ecmascript$29$__["from"])(char()), (0, __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Utility$2e$js__$5b$client$5d$__$28$ecmascript$29$__["substr"])(value, 2, -2), 0, siblings);
}
This may be a bit noisy, but if we extract the diff, we can see that the char() function, which is defined in the stylist module, is not being resolved correctly, resulting in an undefined error for char().
- __TURBOPACK__imported__module__$5b$project$5d2f$node_modules$2f2e$pnpm$2f$stylis$40$4$2e$3$2e$2$2f$node_modules$2f$stylis$2f$src$2f$Tokenizer$2e$js__$5b$client$5d$__$28$ecmascript$29$__["char"])()
+ char()It is unclear why this is happening, but it started occurring when the caniuse-lite version was bumped to 1.0.30001754.
Even if we try to skip the stylis where this error occurs, similar errors occur in other places, so it seems that there is some kind of bug in turbopack.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.6.0: Wed Oct 15 21:12:44 PDT 2025; root:xnu-11417.140.69.703.14~1/RELEASE_ARM64_T8112
Available memory (MB): 24576
Available CPU cores: 8
Binaries:
Node: 22.10.0
npm: 10.9.0
Yarn: N/A
pnpm: 9.15.3
Relevant Packages:
next: 16.0.2 // Latest available version is detected (16.0.2).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
SWC, Turbopack, Pages Router, Module Resolution
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
The above error disappears with the following changes
- Remove browserslist field from package.json
- Or downgrade caniuse-lite to 1.0.30001753 or earlier
I'm not sure that this is an error of turbopack or SWC. But I think something about bundling or compiling is wrong in some conditions.