arsenalfandan
arsenalfandan

Reputation: 33

Svelte include dynamically imported components in build folder

I am following the example here to try to load components.

onMount(async () => {
    await sleep(1000); // simulate network delay
    Thing = (await import('./Thing.svelte')).default;
});

It obviously works in the REPL but when I try it in my dev environment I get the error:

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://localhost:5000/build/Thing.svelte

It seems that Svelte isn't including the component in the build folder? There must be something I am missing?

Upvotes: 1

Views: 338

Answers (1)

arsenalfandan
arsenalfandan

Reputation: 33

I needed to add inlineDynamicImports: true to the output object in the rollup.config.js

Upvotes: 1

Related Questions