Pages - Cloudflare uses wrong URL for async import in development build

Hello Cloudflare community! I have a trouble with webpack and Cloudflare pages.

Link: develop.kop-dev.pages.dev

I have a trouble loading dynamic modules in typescript using Webpack.
Everything loads (Static imports, Assets etc…) But if there is code like
const { getSpellName, getSpellDescription } = await import('./KoP_Locale/abilites');


It is resolved to different URL: https://static.cloudflareinsights.com but it should be the link kop-dev.pages

It sometimes works if i rebuild the page multiple times, sometimes it works. Do you know what i can possibly do wrong or if this is an issue with Cloudflare?
I am using ‘tsconfig-paths-webpack-plugin’ to resolve non-relative paths.

Thanks for all helps!

This is a URL that Cloudflare uses to add analytics to your site. It has nothing to do with your code.

1 Like

Hey thanks! I found solution, for some reason webpack refers to this url for async imports.

Solution was missing publicPath in webpack config.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.