Closed adamburgess closed 3 years ago
May be a duplicate of #3045, although this issue is specifically for the config files which should be ran in node and nothing else (right? the config files aren't ever used in the browser, yeah?)
Verbose output of esm snowpack.config.mjs config:
[15:53:22] [snowpack] Welcome to Snowpack! Because this is your first time running
this project, Snowpack needs to prepare your dependencies. This is a one-time step
and the results will be cached for the lifetime of your project. Please wait...
[15:53:22] [snowpack] Skip scanning README.md for imports (unknown file extension .md)
[15:53:22] [snowpack] Scanning index.html for imports as HTML
[15:53:22] [snowpack] Skip scanning package-lock.json for imports (unknown file extension .json)
[15:53:22] [snowpack] Skip scanning package.json for imports (unknown file extension .json)
[15:53:22] [snowpack] Scanning snowpack.config.mjs for imports as JS
[15:53:22] [snowpack] Package "fs" not found. Have you installed it?
[15:53:22] [snowpack] Error: Package "fs" not found. Have you installed it?
at Object.resolveEntrypoint (/home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:43664:15)
at Object.resolvePackageImport (/home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:54611:34)
at /home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:54584:31
at Array.map (<anonymous>)
at Object.prepare (/home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:54582:80)
at async startServer (/home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:131204:9)
at async Object.command (/home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:131805:9)
at async cli (/home/adam/WSLProjects/snowpack-test-import/node_modules/snowpack/lib/index.js:132393:9)
Verbose output of cjs snowpack.config.js config:
[15:55:15] [snowpack] Welcome to Snowpack! Because this is your first time running
this project, Snowpack needs to prepare your dependencies. This is a one-time step
and the results will be cached for the lifetime of your project. Please wait...
[15:55:15] [snowpack] Skip scanning README.md for imports (unknown file extension .md)
[15:55:15] [snowpack] Scanning index.html for imports as HTML
[15:55:15] [snowpack] Skip scanning package-lock.json for imports (unknown file extension .json)
[15:55:15] [snowpack] Skip scanning package.json for imports (unknown file extension .json)
[15:55:15] [snowpack] Scanning snowpack.config.js for imports as JS
[15:55:15] [snowpack] No dependencies detected. Ready!
[15:55:15] [snowpack] attaching console.log listeners
[15:55:15] [snowpack] dashboard started
[15:55:15] [snowpack] Mounting directory: '/home/adam/WSLProjects/snowpack-test-import' as URL '/'
[15:55:15] [snowpack] Using in-memory cache: [object Object]
[15:55:15] [snowpack] Server started in 13ms.
Ok. If I follow the blank template which adds a mount for the src
directory, and then put all my browser code in src
, then only src
is scanned, and everything works fine.
Maybe user error, I'm not sure. I feel like this shouldn't cause an error. Anyways, closing for now.
Bug Report Quick Checklist
Describe the bug
If I use an ESM config file for snowpack (either
type: "module"
in package.json ORsnowpack.config.mjs
), I cannot import node modules.To Reproduce
https://github.com/adamburgess/snowpack-test-import
npm install --save snowpack
snowpack dev
[15:21:30] [snowpack] Welcome to Snowpack! Because this is your first time running this project, Snowpack needs to prepare your dependencies. This is a one-time step and the results will be cached for the lifetime of your project. Please wait... [15:21:30] [snowpack] Package "fs" not found. Have you installed it?