Netlify moving dynamic imports into /public/assets/ folder

My site is

My issue here is not an error during the build but after the build, it seems that netlify is changing the path of one of my dynamicaly imported folders, which is originaly in ./src folder and its called ‘langs’, so it would be ./src/langs

my issue here is that after deployment, that folder is somehow moved into the /public/assets/ path, without me allowing it, the thing is, i dont really know how to change this, i tried moving the langs folder into my actual /pulic/assets/ folder, and it doesnt recognize the scripts that im importing from there either, even tho the files are fully loaded and show its code into the inspector.

this is the file imported from the folder ./src/langs/:

import config from "../config.json"

var usernameInfo = `👤 Usernames should have these minimum requirements:\n\n- Minimum of ${config.minLengthUsername} characters\n- Maximum of ${config.maxLengthUsername} characters\n- No symbols or spaces\n\n⚠️ Be aware! If you are registering for the first time, you will NOT be able to change your username anymore after registering, be careful!`
var passwordInfo = `🔑 Passwords should have these minimum requirements:\n\n- Uppercase and lowercase characters\n- ${config.minLengthPassword} or more characters (up to ${config.maxLengthPassword})\n- Have a minimum of ${config.numbersOnPassword} number${config.numbersOnPassword > 1 ? 's' : ''} & ${config.symbolsOnPassword} symbol${config.symbolsOnPassword > 1 ? 's' : ''}\n- No spaces\n\n🧾 If you forgot your password, please contact us on the following:\`
var userError = `Usernames should be more than ${config.minLengthUsername} characters and less than ${config.maxLengthUsername}`

export const data = {
    session: {
        accountText: 'Account',
        loginText: 'Login',
        registerText: 'Register',
        userText: 'Username',
        userExample: 'youruser',
        mailText: 'Email',
        mailExample: '',
        passText: 'Password',
        passExample: 'password',
        lacksAccountText: "Don't have an account?",
        hasAccountText: "Already have an account?",
        logoutText: 'Log out',
        requiredText: {
            user: 'Required username',
            mail: 'Required email',
            pass: 'Required password'
    date: {
        postedText: 'Posted {1} {2} ago',
        createdText: 'Created {1} {2} ago',
        sec: 'second',
        secs: 'seconds',
        min: 'minute',
        mins: 'minutes',
        hour: 'hour',
        hours: 'hours',
        day: 'day',
        days: 'days',
        month: 'month',
        months: 'months',
        year: 'year',
        years: 'years'
    buttons: {
        homeText: 'Home',
        profileText: 'Profile',
        settingsText: 'Settings',
        postText: 'Post',
        donateText: 'Donate'
    text: {
        userinfo: usernameInfo,
        passinfo: passwordInfo,
        aboutMeText: 'About me! (This doesnt work yet..)',
        followerText: 'Follower',
        followersText: 'Followers',
        themesText: 'Themes',
        donationText: 'Wideopen donations will asure the prosperity of this social app. Feel free to donate if you want!',
        updateText: 'Update',
        publishText: 'Publish',
        postText: 'Write your post here...',
        wideopen: 'WideOpen',
        userError: userError,
        openOriginalText: 'Open original'

and ./App.jsx on how it imports the file:

    const userLanguage = navigator.language.slice(0,2) || navigator.userLanguage.slice(0,2);
    var dataModule = import('./langs/'+userLanguage);

i can asure you this is not a programatic issue as i tested this on a dev run and i works perfectly fine, its right after i deploy the page, that this issue starts happening.

this is the error i get on on my console:

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: wideopen

(remember that even with that error showing up, the file still loads into my inspector, all its text and content is fully loaded, but it still shows up as an error)

I tried loading your website and I don’t see any such errors. Has this been resolved?

yes, the error was fixed by just changing




1 Like

Hi @xhyabunny,

Thanks for following up and letting us know how you resolved the issue. Hope you have a great day!