Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign to read only property 'exports' of object '#<Object>' #1217

Closed
1 of 2 tasks
andorfermichael opened this issue Jun 29, 2021 · 7 comments
Closed
1 of 2 tasks

Comments

@andorfermichael
Copy link

andorfermichael commented Jun 29, 2021

Version

nuxt-i18n: 6.27.1
nuxt: 2.15.6

Nuxt configuration

mode:

  • universal
  • spa

Nuxt-i18n configuration

...
    i18n: {
        lazy: true,
        langDir: '~/locales/',
        defaultLocale: process.env.DEFAULT_LOCALE,
        detectBrowserLanguage: false,
        differentDomains: true,
        locales: locales(process.env.SUB_DOMAIN),
        vueI18n: {
            fallbackLocale: process.env.DEFAULT_LOCALE
        },
        vuex: {
            syncLocale: true
        }
    }
...
export const locales = (domain) => [
    {
        code: 'ar',
        iso: 'ar',
        file: 'ar.json',
        dir: 'rtl',
        domain: `${domain}.company.ae`,
        name: 'العَرَبِيَّة',
        enName: 'Arabic',
        defaultLanguage: true,
        languages: ['ar'],
        certified: false
    },
    {
        code: 'de',
        iso: 'de',
        file: 'de.json',
        dir: 'ltr',
        domain: `${domain}.company.de`,
        name: 'Deutsch',
        enName: 'German',
        defaultLanguage: true,
        languages: ['de'],
        certified: true
    },
    {
        code: 'en',
        iso: 'en',
        file: 'en.json',
        dir: 'ltr',
        domain: `${domain}.company.com`,
        name: 'English',
        enName: 'English',
        defaultLanguage: true,
        languages: ['en'],
        certified: true
    },
    ...
]

Reproduction Link

Cannot provide reproduction link, since project is way too big with hundreds of i18n usages and I am not sure which piece of code might cause the issue.

Steps to reproduce

n.a.

What is Expected?

SPA running as it was before with v6.27.0

What is actually happening?

Starting with nuxt-i18n v6.27.1 I get the following error when running my SPA Cannot assign to read only property 'exports' of object '#<Object>'

It seems that you introduced either a new bug or a breaking change in release v6.27.1.

@rchl
Copy link
Collaborator

rchl commented Jun 29, 2021

Sometimes Nuxt has issues with invalidating its cache when updating dependencies.
Try again after deleting node_modules and re-installing.

@andorfermichael
Copy link
Author

Sometimes Nuxt has issues with invalidating its cache when updating dependencies.
Try again after deleting node_modules and re-installing.

did not change anything, unfortunately

@rchl
Copy link
Collaborator

rchl commented Jun 29, 2021

Then you would need to try to minimize your project to create a repro.

For now your best bet is to pin the 2.27.0 version if that works.

@stale
Copy link

stale bot commented Sep 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 3, 2021
@rchl
Copy link
Collaborator

rchl commented Sep 8, 2021

Looking at the linked issue nuxt-community/axios-module#501, it seems like it was not related to this module after all.

@rchl rchl closed this as completed Sep 8, 2021
@andorfermichael
Copy link
Author

andorfermichael commented Sep 15, 2021

@rchl

I have to reopen this ticket. I created two code sandboxes for reproduction:

  1. nuxt-i18n v6.27.0 - working

  2. nuxt-i18n v6.27.1 - not working

Everything > 6.27.1 (incl. @nuxtjs/i18n starting with v7) does not work.

@rchl
Copy link
Collaborator

rchl commented Sep 15, 2021

What's the reason that you have customized the build.babel option? Is it just to enable corejs 3? If so then you can do it with a build: { corejs: 3 } instead and it should fix your problem.

I think that by customizing build.babel you have disabled support for some language constructs that the default config supports. Unless you know what you are doing, you should use the corejs option instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants