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

Custom key of nuxt app context #15234

Closed
4 tasks done
chengzhuo5 opened this issue Oct 22, 2022 · 4 comments
Closed
4 tasks done

Custom key of nuxt app context #15234

chengzhuo5 opened this issue Oct 22, 2022 · 4 comments

Comments

@chengzhuo5
Copy link

chengzhuo5 commented Oct 22, 2022

Describe the feature

https://github.com/nuxt/framework/blob/02227a2f1b86b077082c50b46cb7486a8672eabe/packages/nuxt/src/app/nuxt.ts#L10
In micro frontend environment, multi apps will be conflicted with same context key (nuxt-app). Can make it configurable in nuxt.config.ts?

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
@odranoelBR
Copy link

Related to #18870

@victorgarciaesgi
Copy link

Is this issue still being discussed? For anyone searching for a tempory super hacky fix for micro-frontend, it can actually be solved with a rollup plugin

import replace from '@rollup/plugin-replace';

const replacePlugin = replace({
    delimiters: ['', ''],
    values: {
        __NUXT__: '__NUXT_MF__',
        'window.__NUXT__.config': 'window.__NUXT_MF__.config',
        [`getContext("nuxt-app")`]: `getContext("nuxt-app-mf")`,
    },
});


export default defineNuxtConfig({
    vite: {
        build: {
            rollupOptions: {
                plugins: [replacePlugin],
            },
        },
        plugins: [replacePlugin],
    },
    nitro: {
        rollupConfig: {
            plugins: [replacePlugin],
        },
    },
});

@nicolaspayot
Copy link
Contributor

I believe this issue can be closed now as it was resolved with #27068.

@victorgarciaesgi
Copy link

I think too, thanks for your work @nicolaspayot the best

@manniL manniL closed this as completed May 15, 2024
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

6 participants