DEV Community

loading...

Discussion on: Svelte x 11ty

Collapse
joakim profile image
Joakim

Clean and simple. Thanks!

Collapse
gobeli profile image
Etienne Author

Thank you Joakim!

Collapse
joakim profile image
Joakim

There's just one small issue (there always is isn't there!). If I import {…} from date-fns in a Svelte component, Rollup will write 'date-fns' is imported by […].svelte, but could not be resolved – treating it as an external dependency to the terminal on every build. Do you know if there's a way to silence that message? I think it comes from @rollup/plugin-node-resolve.

Thread Thread
gobeli profile image
Etienne Author

Yeah, external dependencies are not resolved for the SSR build, to silence the warning you can explicitly treat date-fns as an external dependency. To do that, just add it to the external: array in the svelte.js shortcode, it should then look like this: external: [/^svelte/, 'date-fns'],

Thread Thread
joakim profile image
Joakim

Nice, thank you so much :)