Closed jorgedanisc closed 1 month ago
Hello @jorgedanisc
I've check you repo. I guess, we may miss option loadPaths
. If you not explicitly specify this option, it will take default from process.cwd()
and it is may not the source root as we expected on github action or Vercel build tasks.
My suggestion:
Update file buildPackage.js
.
plugins: [sassPlugin({
type: 'css',
loadPaths: ['.']
})],
If this not work. You may move file buildPackage.js
into folder packages/core/canvas
.
Update import source of css
, scss
files.
- @import "open-color/open-color";
+ @import "~open-color/open-color"; // `esbuild-sass-plugin` resolve package from `node_modules` with prefix `~`
Hope this help.
Thank you for the help! I had already solved this issue yesterday by doing some backward compatibility with a working build I had in the past and got it to work.
However I wanted to keep this issue open so that this error would be addressed as I haven't seen anybody with this error message in particular. I will be closing it now, and if I face this problem again will attempt to make these changes so thank you.
Repo: https://github.com/ducflair/duc/blob/main/packages/core/scripts/buildPackage.js
On this project, when I build locally, there is no problems, it runs without any error, however when I deploy to Vercel or run a Github Action for example I get this:
rm -rf dist && bun run ../scripts/buildPackage.js && bun run gen:types
✘ [ERROR] [BUG] Unreachable [plugin sass-plugin]
✘ [ERROR] [BUG] Unreachable [plugin sass-plugin]
✘ [ERROR] [BUG] Unreachable [plugin sass-plugin]
✘ [ERROR] [BUG] Unreachable [plugin sass-plugin]
✘ [ERROR] [BUG] Unreachable [plugin sass-plugin]
and it goes on and on, this error is raised on every .scss import inside packages/core/canvas
More logs:
1645 | let { file, line, column } = e.location; 1646 | let pluginText = e.pluginName ?
[plugin: ${e.pluginName}]
: ""; 1647 | return1648 | ${file}:${line}:${column}: ERROR: ${pluginText}${e.text}
; 1649 | }).join(""); 1650 | let error = new Error(text); ^ error: Build failed with 45 errors: actions/actionExport.tsx:21:7: ERROR: [plugin: sass-plugin] [BUG] Unreachable components/Button.tsx:4:7: ERROR: [plugin: sass-plugin] [BUG] Unreachable components/CheckboxItem.tsx:5:7: ERROR: [plugin: sass-plugin] [BUG] Unreachable components/ColorPicker/ColorPicker.tsx:22:7: ERROR: [plugin: sass-plugin] [BUG] Unreachable components/ConfirmDialog.tsx:4:7: ERROR: [plugin: sass-plugin] [BUG] Unreachable ... errors: [ { "id": "", "location": { "column": 7, "file": "actions/actionExport.tsx", "length": 29, "line": 21, "lineText": "import \"../components/ToolIcon.scss\";", "namespace": "", "suggestion": "" }, "notes": [], "pluginName": "sass-plugin", "text": "[BUG] Unreachable" }, { "id": "", "location": { "column": 7, "file": "components/Button.tsx", "length": 15, "line": 4, "lineText": "import \"./Button.scss\";", "namespace": "", "suggestion": "" }, "notes": [], "pluginName": "sass-plugin", "text": "[BUG] Unreachable" }, { "id": "", "location": { "column": 7, "file": "components/CheckboxItem.tsx", "length": 21, "line": 5, "lineText": "import \"./CheckboxItem.scss\";", "namespace": "", "suggestion": "" }, "notes": [], "pluginName": "sass-plugin", "text": "[BUG] Unreachable" }, { "id": "", "location": { "column": 7, "file": "components/ColorPicker/ColorPicker.tsx", "length": 20, "line": 22, "lineText": "import \"./ColorPicker.scss\";", "namespace": "", "suggestion": "" }, "notes": [], "pluginName": "sass-plugin", "text": "[BUG] Unreachable" },Bun v1.1.30 (Linux x64 baseline) error: script "build:esm" exited with code 1 error: script "build" exited with code 1 Error: command finished with error: command (/home/runner/work/duc/duc/packages/core/canvas) /home/runner/.bun/bin/bun run build exited (1)