sveltefire
sveltefire copied to clipboard
Error: Cannot find module '[…]/node_modules/sveltefire/dist/index.js'.
Heya, I'm getting the error mentioned in the title @0.1.4. Here's the full trace:
internal/modules/cjs/loader.js:337
throw err;
^
Error: Cannot find module '[…]/node_modules/sveltefire/dist/index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:329:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:690:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1017:27)
at Function.Module._load (internal/modules/cjs/loader.js:899:27)
at Module.require (internal/modules/cjs/loader.js:1090:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> ([…]/__sapper__/dev/server/server.js:10:18)
at Module._compile (internal/modules/cjs/loader.js:1201:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
at Module.load (internal/modules/cjs/loader.js:1050:32) {
code: 'MODULE_NOT_FOUND',
path: '[…]/node_modules/sveltefire/package.json',
requestPath: 'sveltefire'
Now I don't know much about JS packaging, but it really does seem like there's no dist/ directory in the NPM package.
I think this happens when you try to render the component on the server side, and browser-side bundling-driven module loading works.
I got rid of this error by being more careful with onMount.
im also getting that issue
Hi @underyx @Suyashtnt , I got the same issue and it looks disturbing to have a field in the package.json pointing to nothing. I think that this should be fixed. I am not sure what the opinion of this project's owner are on it, whether it is skipped on purpose or not.
In my case, because I am trying to stay close to the template (https://github.com/codediodeio/sveltefire-template), I moved the dependency declaration devDependencies so that Rollup uses the src instead of dist.
I don't fully understand why it is better, but it is a recommended approach in the Svelte ecosystem with Rollup: https://github.com/sveltejs/component-template#consuming-components
I'd love to get a pointer to a blog article or explanation for this practice (does it have to do with the Svelte compiler ? The SSR ?)