Back

[SOLVED] Netlify moving dynamic imports into /public/assets/ folder

  • 0
  • Web
bonndubz
26 Nov, 2023, 15:41

i need to use http-server brb

TL;DR
Solution: The user was able to solve the issue by making changes to the import module and export statements in their code. They also mentioned trying to push all the language scripts into the src folder. The error message regarding MIME type checking is likely related to a problem with Netlify. The user plans to use http-server to further investigate the issue.
bonndubz
26 Nov, 2023, 15:42

okay here

bonndubz
26 Nov, 2023, 15:42

yeah theres

bonndubz
26 Nov, 2023, 15:42

no import issues here

bonndubz
26 Nov, 2023, 15:42

just the cors stuff

bonndubz
26 Nov, 2023, 15:42

but nothing about importing stuff

bonndubz
26 Nov, 2023, 15:43

actually one of the textes inside these imported scripts is working on the page

bonndubz
26 Nov, 2023, 15:43

so it means that they've been correctly imported into the app.jsx file

Drake
26 Nov, 2023, 15:50

Interesting...so maybe it is a netlify problem lol

bonndubz
26 Nov, 2023, 15:56

THEY JUST CENSORED MY POST ๐Ÿ’€

bonndubz
26 Nov, 2023, 16:10

now im getting this

bonndubz
26 Nov, 2023, 16:10

es:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

then this

index-xNIsFJLs.js:63 Error loading module: TypeError: Failed to fetch dynamically imported module: https://wopen.netlify.app/assets/langs/es

bonndubz
26 Nov, 2023, 16:12

i found how the build encrypts the js main script where it imports the dynamic module

TypeScript
  var t = vg(()=>import("./langs/" + e), __vite__mapDeps([]));

and im not sure on what to think

bonndubz
26 Nov, 2023, 16:12

it seems to be all good

bonndubz
26 Nov, 2023, 16:14

like you can see the file is clearly not even changing its path after the build

bonndubz
26 Nov, 2023, 16:14

im actually lost here

bonndubz
26 Nov, 2023, 16:15

ill try pushing all the langs scripts into the src folder

bonndubz
26 Nov, 2023, 17:02

so i fixed it by changing

TypeScript
export const data

to

TypeScript
export { data }
bonndubz
26 Nov, 2023, 17:02

and the import module looks like this

TypeScript
let dataModule = import(`./langs/_${userLanguage}.js`);
bonndubz
26 Nov, 2023, 17:03

i also changed scripts name with an underscore before their names

bonndubz
26 Nov, 2023, 17:03

but thats optional

bonndubz
26 Nov, 2023, 17:03

apparently it had to do with the way i was writing the overload

bonndubz
26 Nov, 2023, 17:04

instead of doing './langs/' + userLanguage

bonndubz
26 Nov, 2023, 17:04

you do ./langs/${userLanguage}

bonndubz
26 Nov, 2023, 17:04

[SOLVED] Netlify moving dynamic imports into /public/assets/ folder

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more