Sandpack/nodebox-runtime

Problem loading @fastify/static

robtweed opened this issue · 2 comments

I'm adding @fastify/static to the package.json file:

{
  "name": "my-app",
  "dependencies": {
    "fastify": "latest",
    "@fastify/static": "latest",
    "fs-extra": "latest",
    "golgi-sbadmin": "latest"
  }
}

but this line appears to fail in the index.js file:

const fastifyStatic = require('@fastify/static');

On inspection of the /nodebox/node_modules directory, @fastify/static isn't included - perhaps the syntax of the "@fastify/static" package name in the package.json file is causing problems and it doesn't get loaded into the file system?

We use a strategy similar to pnpm on how to structure our node modules, so they're actually stored in /nodebox/node_modules/.store, in your case that would be /nodebox/node_modules/.store/@fastify/static

But there should still be a symlink from /nodebox/node_modules/@fastify/static to /nodebox/node_modules/.store/@fastify/static

Could you create a minimal reproduction so we can debug this?

I think it was my fault after all - I was require()ing fastify-static before I'd imported Fastify. I'll close this now. Thanks and apologies