fresh
fresh copied to clipboard
Vite plugin for `vanilla-extract` does not work.
How to reproduce:
- Create a new Fresh project.
- Build the project with
deno task build - Add vanilla-extract and the vite plugin by running:
deno install --npm @vanilla-extract/css
deno install --npm --dev @vanilla-extract/vite-plugin
- Add the plugin to your Vite config like this:
import { defineConfig } from "vite";
import { fresh } from "@fresh/plugin-vite";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
export default defineConfig({
plugins: [fresh(), vanillaExtractPlugin()],
});
- Run
deno task buildand get an error like the following:
Error Log
PS C:\Users\jade\Repositories\reproductiontest> deno task build
Task build vite build
error during build:
Error: Couldn't find parent package.json with a name field from 'C:/Users/jade/Repositories/reproductiontest'
at Object.getPackageInfo (file:///C:/Users/jade/Repositories/reproductiontest/node_modules/.deno/@[email protected]/node_modules/@vanilla-extract/integration/dist/vanilla-extract-integration.cjs.prod.js:351:11)
at BasicMinimalPluginContext.configResolved (file:///C:/Users/jade/Repositories/reproductiontest/node_modules/.deno/@[email protected]/node_modules/@vanilla-extract/vite-plugin/dist/vanilla-extract-vite-plugin.cjs.prod.js:110:33)
at file:///C:/Users/jade/Repositories/reproductiontest/node_modules/.deno/[email protected]_2/node_modules/vite/dist/node/chunks/dep-C6pp_iVS.js:36390:87
at Array.map (<anonymous>)
at resolveConfig (file:///C:/Users/jade/Repositories/reproductiontest/node_modules/.deno/[email protected]_2/node_modules/vite/dist/node/chunks/dep-C6pp_iVS.js:36390:68)
at eventLoopTick (ext:core/01_core.js:179:7)
at async createBuilder (file:///C:/Users/jade/Repositories/reproductiontest/node_modules/.deno/[email protected]_2/node_modules/vite/dist/node/chunks/dep-C6pp_iVS.js:34583:19)
at async CAC.<anonymous> (file:///C:/Users/jade/Repositories/reproductiontest/node_modules/.deno/[email protected]_2/node_modules/vite/dist/node/cli.js:647:19)
Simple reproduction repo for this issue -> https://github.com/fry69/fresh-vite-vanilla-repro
Just run deno task build to provoke mentioned error.
Seems like an upstream issue. I think they're no accounting for Deno projects where package.json is not a requirement.