bluwy/create-vite-extra

vite-plugin-solid is broken without package.json

daniellionel01 opened this issue · 1 comments

I copied the template template-deno-solid, but when running this command I got the following error:

$ deno task dev
Task dev deno run -A --node-modules-dir npm:vite
error when starting dev server:
Error: Cannot find package.json from /home/danielkurz/code/deno-solid
    at crawlFrameworkPkgs (file:///home/danielkurz/code/deno-solid/node_modules/.deno/vite-plugin-solid@2.4.0/node_modules/vitefu/src/index.js:17:11)
    at async config (file:///home/danielkurz/code/deno-solid/node_modules/.deno/vite-plugin-solid@2.4.0/node_modules/vite-plugin-solid/dist/esm/index.mjs:52:31)
    at async runConfigHook (file:///home/danielkurz/code/deno-solid/node_modules/.deno/vite@3.2.4/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:62870:25)
    at async resolveConfig (file:///home/danielkurz/code/deno-solid/node_modules/.deno/vite@3.2.4/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:62379:14)
    at async createServer (file:///home/danielkurz/code/deno-solid/node_modules/.deno/vite@3.2.4/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:61641:20)
    at async CAC.<anonymous> (file:///home/danielkurz/code/deno-solid/node_modules/.deno/vite@3.2.4/node_modules/vite/dist/node/cli.js:707:24)

And when you go to the code where the error originates, it makes sense why it throws an error:

// /node_modules/.deno/vite-plugin-solid@2.4.0/node_modules/vitefu/src/index.js:17:11
export async function crawlFrameworkPkgs(options) {
  const pkgJsonPath = await findClosestPkgJsonPath(options.root)
  if (!pkgJsonPath) {
    throw new Error(`Cannot find package.json from ${options.root}`)
  }

I fixed it by running "yarn init" so just creating a simple and mostly empty package.json. I'll create another issue with the vite-solid-plugin, since this repo will not address this problem, but maybe you should add an empty package.json in this repo aswell.

bluwy commented

It's a duplicate of #12. I've sent solidjs/vite-plugin-solid#73 which is waiting to be merged.