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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nuxt): resolve nitro config entries in layers (nuxt aliases) #26679

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

userquin
Copy link
Member

@userquin userquin commented Apr 6, 2024

馃敆 Linked issue

resolves #26517

馃摎 Description

publicAssets and public folders not being resolved and so we cannot use Nuxt alias.

This PR also includes layers public directories to nitro configuration.

Copy link

stackblitz bot commented Apr 6, 2024

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

const { dir: rootDir, srcDir, alias: rootAlias } = nuxt.options
await Promise.all(nuxt.options._layers.map((layer) => {
return Promise.all((layer.config.nitro?.publicAssets || []).map(async (publicAsset) => {
if (!publicAsset) {
Copy link
Member Author

@userquin userquin Apr 6, 2024

Choose a reason for hiding this comment

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

shold we use !publicAssets?.dir instead: if so, we should also remove || rootDir.public || 'public' from L617 and || layer.config.dir?.public || 'public'from L618

Copy link
Member Author

Choose a reason for hiding this comment

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

I've exluded publicAssets without dir

const dir = await resolvePath(path, { cwd, alias: alias as Record<string, string> })
// TODO: should warn if missing?
if (existsSync(dir)) {
publicAsset.dir = dir
Copy link
Member Author

Choose a reason for hiding this comment

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

should warn or even throw?

@userquin userquin changed the title fix(nuxt): resolve public paths and public assets dir in layers fix(nuxt): resolve nitro config in layers (nuxt aliases) Apr 6, 2024
@userquin userquin changed the title fix(nuxt): resolve nitro config in layers (nuxt aliases) fix(nuxt): resolve nitro config entries in layers (nuxt aliases) Apr 6, 2024
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.

Public assets 404 Not Found with Nitro publicAssets maxAge is set.
1 participant