SWC plugin context in Turbopack includes only basename instead of full path #78181
Labels
linear: turbopack
Confirmed issue that is tracked by the Turbopack team.
Turbopack
Related to Turbopack with Next.js.
Link to the code that reproduces this issue
https://github.com/DigitecGalaxus/next-yak/tree/turbopack-plugin-syntax
To Reproduce
Currently the reproduction is only available on a branch which works around the fact that turbopack is not able to work with absolut paths (see issue #78156) - Please let me know if it's still okay
git clone https://github.com/DigitecGalaxus/next-yak/ -b turbopack-plugin-syntax
pnpm i
pnpm run build && pnpm run build:swc
cd packages/example
npx next build --turbopack
You'll see errors like:
Current vs. Expected behavior
metadata.get_context(&TransformPluginMetadataContextKind::Filename)
returns only the basename (e.g.,layout.tsx
) without any directory informationExpected behavior:
/full/path/to/app/layout.tsx
)Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 Available memory (MB): 65536 Available CPU cores: 10 Binaries: Node: 20.18.2 npm: 10.8.2 Yarn: 1.22.22 pnpm: 9.12.3 Relevant Packages: next: 15.3.1-canary.8 eslint-config-next: N/A react: 19.0.0 react-dom: 19.0.0 typescript: 5.7.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
We use the following rust code to read the filename from the context:
The text was updated successfully, but these errors were encountered: