Closed sqal closed 3 days ago
The error is due to logger.warn
function is passed to worker thread for scss processing. This is the actual error,
DOMException [DataCloneError]: warn(message, options) {
} could not be cloned.
at new DOMException (node:internal/per_context/domexception:53:5)
at Worker.postMessage (node:internal/worker:378:5)
but this caught error is throwing due to e.message = ...
assignment
It's possible to "fix" it by adding logger
to the list of fallback condition, but then it would make preprocessorMaxWorkers
to have no effect since it doesn't use workers.
Btw, can you explain why you want to use logger.warn
? If you only need to silence certain deprecation warning (for example mixed-decls
discussed in https://github.com/sass/dart-sass/issues/2276), then it should be now possible (since 5.4.0-beta.1) to use api: "modern"
or api: "modern-compiler"
and silenceDeprecations
options:
export default defineConfig({
css: {
preprocessorMaxWorkers: true,
preprocessorOptions: {
scss: {
api: 'modern',
silenceDeprecations: ['mixed-decls'],
},
},
},
});
I wanted to use logger to filter out some warnings from third-party packages in node_modules. I think I'll just use silenceDeprecations then. Thanks for the tip.
Describe the bug
When I try to use custom sass logger and have enabled option
preprocessorMaxWorkers
, vite throws the following error:Full log
``` vite v5.3.5 building for production... ✓ 6 modules transformed. x Build failed in 63ms error during build: [vite:css] Cannot set property message of which has only a getter file: C:/Users/.../test/style.scss at process (file:///C:/Users/.../test/node_modules/.pnpm/vite@5.3.5_sass@1.77.8/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:37332:19) at async compileCSSPreprocessors (file:///C:/Users/.../test/node_modules/.pnpm/vite@5.3.5_sass@1.77.8/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:36633:28) at async compileCSS (file:///C:/Users/.../test/node_modules/.pnpm/vite@5.3.5_sass@1.77.8/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:36687:32) at async Object.transform (file:///C:/Users/.../test/node_modules/.pnpm/vite@5.3.5_sass@1.77.8/node_modules/vite/dist/node/chunks/dep-mCdpKltl.js:36084:11) at async transform (file:///C:/Users/.../test/node_modules/.pnpm/rollup@4.19.2/node_modules/rollup/dist/es/shared/node-entry.js:18774:16) at async ModuleLoader.addModuleSource (file:///C:/Users/.../test/node_modules/.pnpm/rollup@4.19.2/node_modules/rollup/dist/es/shared/node-entry.js:18990:36) ELIFECYCLE Command failed with exit code 1. ```This bug also occures in vite version 5.4.0-beta.1.
Steps to reproduce
Create new vite project
pnpm create vite@latest
and vanillajs templateInstall
sass
and replacestyles.css
extensionAdd vite.config.js
build
ordev
commandSystem Info
Used Package Manager
pnpm
Logs
No response
Validations