figma-plugin-react-vite icon indicating copy to clipboard operation
figma-plugin-react-vite copied to clipboard

sass.initAsyncCompiler is not a function

Open danielmenezesbr opened this issue 7 months ago • 2 comments

Hello,

I am encountering an issue when running the npm run build command. The process fails and returns the following error:

User@DESKTOP-NSIFQE4 MINGW64 /c/projects/figma-plugin-react-vite (master)
$ npm run build

> [email protected] prebuild
> run-s types clean


> [email protected] types
> run-s types:*


> [email protected] types:src
> tsc


> [email protected] types:node
> tsc -P tsconfig.node.json


> [email protected] clean
> rm -Rf dist/*


> [email protected] build
> run-s build:*


> [email protected] build:ui
> vite build -c ./vite.config.ui.ts

The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.4.10 building for production...
✓ 10 modules transformed.
x Build failed in 247ms
error during build:
[vite:css] [sass] sass.initAsyncCompiler is not a function
file: C:/projects/figma-plugin-react-vite/src/ui/styles/main.scss
    at Object.run (file:///C:/projects/figma-plugin-react-vite/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:37493:32)
    at async process (file:///C:/projects/figma-plugin-react-vite/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:37577:24)
    at async compileCSSPreprocessors (file:///C:/projects/figma-plugin-react-vite/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:36741:28)
    at async compileCSS (file:///C:/projects/figma-plugin-react-vite/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:36795:32)
    at async Object.transform (file:///C:/projects/figma-plugin-react-vite/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:36170:11)
    at async transform (file:///C:/projects/figma-plugin-react-vite/node_modules/rollup/dist/es/shared/node-entry.js:19640:16)
    at async ModuleLoader.addModuleSource (file:///C:/projects/figma-plugin-react-vite/node_modules/rollup/dist/es/shared/node-entry.js:19856:36)
ERROR: "build:ui" exited with 1.

User@DESKTOP-NSIFQE4 MINGW64 /c/projects/figma-plugin-react-vite (master)
$ node -v
v18.20.8

The previous commands were executed on Windows, but I received the same result when I ran them on macOS.

danielmenezesbr avatar Mar 30 '25 12:03 danielmenezesbr

I noticed that using pnpm install && pnpm run build works.

danielmenezesbr avatar Mar 30 '25 12:03 danielmenezesbr

Hey there!

Wooops, looks like a package-lock.json slipped in. This boilerplate intends to use PNPM, I suspect that might be the reason why it works when you reinstall via pnpm install. I'll have to remove the lock file, and note the usage of PNPM under README.

Thanks for letting me know! 😁

iGoodie avatar Mar 30 '25 14:03 iGoodie