From what I can tell in the error, when adding custom dependencies to sandpack in a template that uses nodepack, the internal module resolution fails if a dependency's package.json doesn't have a name field.
error when starting dev server:
Error: Couldn't find parent package.json with a name field from '/nodebox'
at Object.getPackageInfo (nodebox:///nodebox/node_modules/.store/@vanilla-extract/integration@6.4.0/node_modules/@vanilla-extract/integration/dist/vanilla-extract-integration.cjs.dev.js:338:11)
at configResolved (nodebox:///nodebox/node_modules/.store/@vanilla-extract/vite-plugin@3.9.5/node_modules/@vanilla-extract/vite-plugin/dist/vanilla-extract-vite-plugin.cjs.dev.js:85:33)
at eval (nodebox:///nodebox/node_modules/.store/vite@4.1.4/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62127:28)
at Array.map (<anonymous>)
at resolveConfig (nodebox:///nodebox/node_modules/.store/vite@4.1.4/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62127:14)
at async createServer (nodebox:///nodebox/node_modules/.store/vite@4.1.4/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61191:20)
at async CAC.eval (nodebox:///nodebox/node_modules/.store/vite@4.1.4/node_modules/vite/dist/node/cli.js:741:24)
Also filed here https://github.com/codesandbox/sandpack/issues/1071
Problem
From what I can tell in the error, when adding custom dependencies to sandpack in a template that uses nodepack, the internal module resolution fails if a dependency's package.json doesn't have a
name
field.The package referenced in the error does have one. It does not have a "parent package", however. https://github.com/vanilla-extract-css/vanilla-extract/blob/fa7105066a5fbb70822af89939abcc48731aeb2e/packages/integration/package.json#L2 https://github.com/vanilla-extract-css/vanilla-extract/blob/951131127feee1e1a0a13b0b4e11e9ae2ba26536/packages/vite-plugin/package.json#L2
Setup
Project
package.json