Skip to content

fix(nuxt): re-initialise nuxt._ignore after all modules run#26680

Merged
danielroe merged 12 commits intonuxt:mainfrom
ineshbose:fix/update-ignore
Apr 19, 2024
Merged

fix(nuxt): re-initialise nuxt._ignore after all modules run#26680
danielroe merged 12 commits intonuxt:mainfrom
ineshbose:fix/update-ignore

Conversation

@ineshbose
Copy link
Copy Markdown
Member

🔗 Linked issue

📚 Description

(I raised this in Discord just about an hour ago, thought I'd make a PR anyway)

The nuxt.options.ignore is not modifiable by Nuxt modules as it is resolved and populated before the modules are installed and modules:done is called. This is because we are resolving layer modules using resolveFiles which calls isIgnored that populates nuxt._ignore if already not populated. So, when the modules are installed and any of them modify nuxt.options.ignore, the !nuxt._ignore condition is never true and options are not updated. This fix will check if nuxt._ignorePattern (as nuxt._ignore is of different type) is outdated from nuxt.options.ignore and re-populate accordingly. Added tests as well.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment thread packages/kit/src/ignore.ts Outdated
@ineshbose ineshbose force-pushed the fix/update-ignore branch from 338328d to 7376a17 Compare April 7, 2024 14:59
@ineshbose ineshbose force-pushed the fix/update-ignore branch from 7376a17 to 414a76f Compare April 7, 2024 15:30
Comment thread packages/kit/src/ignore.ts Outdated
Copy link
Copy Markdown
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I think about this, the more I think we should initiate nuxt ignorer after modules have finished running (maybe directly before build?) - and we should no longer check the contents of nuxt.options.ignore.

@TheAlexLichter
Copy link
Copy Markdown
Member

@danielroe you mean for nuxt 4?

@danielroe
Copy link
Copy Markdown
Member

I think we can do it in a non breaking way for Nuxt 3.

@danielroe danielroe changed the title fix(kit): allow updating of nuxt.options.ignore fix(nuxt): re-initialise nuxt._ignore after modules:done hook Apr 18, 2024
@danielroe danielroe changed the title fix(nuxt): re-initialise nuxt._ignore after modules:done hook fix(nuxt): re-initialise nuxt._ignore after modules:done hook Apr 18, 2024
@danielroe danielroe changed the title fix(nuxt): re-initialise nuxt._ignore after modules:done hook fix(nuxt): re-initialise nuxt._ignore after all modules run Apr 19, 2024
@danielroe danielroe merged commit 00a47be into nuxt:main Apr 19, 2024
@github-actions github-actions Bot mentioned this pull request Apr 19, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants