microsite icon indicating copy to clipboard operation
microsite copied to clipboard

getStaticProps + node builtins + dev server fails

Open mxmul opened this issue 5 years ago • 1 comments

I've been trying to statically generate pages with getStaticProps and getStaticPaths, but the dev server crashes whenever I try to import fs; production builds work just fine.

 ❱ yarn start
yarn run v1.22.10
warning package.json: No license field
$ microsite
[snowpack] ! building dependencies...
~/snowpack/esinstall/lib/entrypoints.js:168
        throw new Error(`Package "${dep}" not found. Have you installed it? ${depManifestLoc ? depManifestLoc : ''}`);
              ^

Error: Package "fs" not found. Have you installed it?
    at Object.resolveEntrypoint (~/snowpack/esinstall/lib/entrypoints.js:168:15)
    at resolveWebDependency (~/snowpack/esinstall/lib/index.js:89:31)
    at Object.install (~/snowpack/esinstall/lib/index.js:203:36)
    at Object.run (~/snowpack/snowpack/lib/sources/local-install.js:43:43)
    at installDependencies (~/snowpack/snowpack/lib/sources/local.js:54:49)
    at async Object.prepare (~/snowpack/snowpack/lib/sources/local.js:109:35)
    at async startServer (~/snowpack/snowpack/lib/commands/dev.js:278:27)
    at async dev (file://~/microsite/examples/root/node_modules/microsite/dist/cli/microsite-dev.js:57:22)

I've tested this with the latest SHA of both [email protected] and snowpack, and get the same result. You should be able to repro by running npm start in this example project: ./examples/root

mxmul avatar Mar 06 '21 18:03 mxmul

Just ran into some weirdness around builtins myself. I'm taking a look!

natemoo-re avatar Mar 07 '21 15:03 natemoo-re