rollup-plugin-svelte-hot icon indicating copy to clipboard operation
rollup-plugin-svelte-hot copied to clipboard

Some module dependencies not found by in memory filesystem

Open antony opened this issue 5 years ago • 4 comments

I'm trying to add HMR support to my existing Sapper apps. Aside from the warnings about named exports which I'm assuming don't factor in to this, it looks like the hmr filesystem is lacking some of my node_modules which it requires.

The error I'm getting is:

ENOENT: no such file or directory, open '/home/ant/Projects/beyonk-pwa/__sapper__/dev/client/@hot/node_modules/@beyonk/gdpr-cookie-consent-banner/dist/style.css'
(node:24456) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/home/ant/Projects/beyonk-pwa/__sapper__/dev/client/@hot/node_modules/@beyonk/gdpr-cookie-consent-banner/dist/style.css'
    at Object.openSync (fs.js:456:3)
    at Object.writeFileSync (fs.js:1297:35)
    at /home/ant/Projects/beyonk-pwa/node_modules/sapper/dist/core.js:491:6
    at Array.forEach (<anonymous>)
    at extract_css (/home/ant/Projects/beyonk-pwa/node_modules/sapper/dist/core.js:469:23)
    at RollupResult.to_json (/home/ant/Projects/beyonk-pwa/node_modules/sapper/dist/core.js:696:9)
    at handle_result (/home/ant/Projects/beyonk-pwa/node_modules/sapper/dist/dev.js:333:28)
    at /home/ant/Projects/beyonk-pwa/node_modules/sapper/dist/dev.js:427:5
    at Object.<anonymous> (/home/ant/Projects/beyonk-pwa/node_modules/sapper/dist/core.js:832:6)
    at Object.emit (events.js:305:20)
(node:24456) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:24456) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I'll see if I can install the dependency by itself into your template project and see if I get the same error, and post the results here.

antony avatar Feb 28 '20 12:02 antony

One extra note, this is a rare css import I'm using directly in _layout.svelte. It looks like this:

  import '@beyonk/gdpr-cookie-consent-banner/dist/style.css'

Will try to import it another way and see if it makes a difference.

antony avatar Feb 28 '20 12:02 antony

Ok. I don't get this error any more when I move it to my global SCSS.

So there's possibly a problem in that the plugin doesn't support importing CSS.

antony avatar Feb 28 '20 12:02 antony

It's very possible I've overlooked some things with CSS... Didn't dig it much yet.

But I've just checked your project's Rollup config and I see nothing in there that would allow importing CSS directly into JS.

Is there something I missed? Does this import work with the official plugin?

rixo avatar Apr 08 '20 01:04 rixo

@rixo It's a good question - I'll create a repro for you since I'm not entirely sure I remember how this works.

antony avatar Apr 08 '20 08:04 antony