-
-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Describe the bug
My vue application uses a library dependency to import sass
@use 'my-sass-lib/text.scss'This library is defined with exports in package.json like so:
"exports": {
"./text.scss": {
"sass": "./dist/text.scss"
},
}This works great for me in standard vitejs, or when the native plugins are disabled, however, when enabling native plugins, this fails to build for me in my github actions runner. It continues to work fine on my windows development machine. I'm not sure if the problem is OS related, but it seems like it might be as the actions runner is using linux.
When it fails this is the error I see:
[sass] Error: Error: Package subpath './_text.scss' is not defined by "exports" in /home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/my-sass-lib/package.json
╷
3 │ @use 'my-sass-lib/text.scss';
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵Full Logs
[sass] Error: Error: Package subpath './_text.scss' is not defined by "exports" in /home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/my-sass-lib/package.json
╷
3 │ @use 'my-sass-lib/text.scss';
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
../../components/TestComponent.vue 3:1 root stylesheet
at handleCompileResponse (/home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/sass-embedded/dist/lib/src/compiler/utils.js:155:15)
at AsyncCompiler.compileRequestAsync (/home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/sass-embedded/dist/lib/src/compiler/async.js:100:54)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Object.run (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:32107:19)
at async process (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:32136:20)
at async compileCSSPreprocessors (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:31553:27)
at async compileCSS (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:31581:30)
at async TransformPluginContextImpl.handler (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:31106:54)
at async plugin (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/rolldown/dist/shared/src-DR2upIfp.mjs:2762:16)
at async plugin.<computed> (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/rolldown/dist/shared/src-DR2upIfp.mjs:3398:12)
at normalizeErrors (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/rolldown/dist/shared/src-DR2upIfp.mjs:2258:18)
at handleOutputErrors (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/rolldown/dist/shared/src-DR2upIfp.mjs:2992:34)
at transformToRollupOutput (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/rolldown/dist/shared/src-DR2upIfp.mjs:2986:2)
at RolldownBuild.write (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/rolldown/dist/shared/src-DR2upIfp.mjs:4186:10)
at async buildEnvironment (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:33419:52)
at async Object.build (file:///home/ubuntu/actions-runner/_work/test-project/test-project/node_modules/vite/dist/node/chunks/dep-DhQ4L5z7.js:33817:19)Of note, it looks like it tries to apply the partial prefix (_) to the subpath and then this fails in an unexpected way since that subpath isn't defined.
I'm not 100% convinced it should be checking for the existence of ./_text.scss in this case considering its a module/package import and not a relative file path, but at the very least it does seem like it shouldn't be failing the build if resolution fails (in the same way that the file not being found doesn't fail the build).
Reproduction
https://stackblitz.com/edit/vitejs-rolldown-vite-exxuejxe?file=packages%2Flib%2Fpackage.json
Steps to reproduce
I tried my best to create a reproducer, but I couldn't get sass or sass-embedded to work in the stackblitz environment. It should at least come close to reproducing the configuration that is failing for me.
System Info
Works on:
System:
OS: Windows 11 10.0.26100
CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12800H
Memory: 13.42 GB / 31.64 GB
Binaries:
Node: 22.17.1 - ~\AppData\Local\fnm_multishells\14552_1753891875747\node.EXE
Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
npm: 10.9.2 - ~\AppData\Local\fnm_multishells\14552_1753891875747\npm.CMD
bun: 1.1.29 - ~\.bun\bin\bun.EXE
Browsers:
Edge: Chromium (133.0.3065.82)
Internet Explorer: 11.0.26100.1882
npmPackages:
@vitejs/plugin-vue: ^6.0.0 => 6.0.1
rolldown-vite: 7.0.12Doesn't work on:
System:
OS: Linux 6.14 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
CPU: (2) x64 AMD EPYC 9R14
Memory: 13.97 GB / 15.25 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 22.18.0 - /opt/hostedtoolcache/node/22.18.0/x64/bin/node
Yarn: 4.9.2 - /usr/local/bin/yarn
npm: 10.9.3 - /opt/hostedtoolcache/node/22.18.0/x64/bin/npm
Browsers:
Chrome: 139.0.7258.66
Chromium: 139.0.7258.0
npmPackages:
@vitejs/plugin-vue: ^6.0.0 => 6.0.1
rolldown-vite: 7.0.12Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs and the Rolldown-related guide.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.