image
image copied to clipboard
feat: added image dir support for nuxt layer
๐ Linked issue
resolves #1879
โ Type of change
- [ ] ๐ Documentation (updates to the documentation or readme)
- [ ] ๐ Bug fix (a non-breaking change that fixes an issue)
- [x] ๐ Enhancement (improving an existing functionality)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
For Nuxt project that uses IPX provider, it would not search nuxt layer's custom dir.
This changes allows Nuxt project with local layers to look for image in layer's dir.
Note: with this changes, similar to root nuxt config with custom dir, would not work for runtime IPX, and only works for ipxStatic provider.
Note 2: As nuxt.options compiles all layer's config, if root is using default config (not providing any), it will have layer's dir value. The image dir config will retrieve from layer's config instead to prevent this issue.
- const path = isRootLayer ? moduleOptions.dir : layer.config.dir?.public || 'public'
+ const path = layer?.config.image?.dir || layer.config.dir?.public || 'public'
@wuiyang is attempting to deploy a commit to the NuxtLabs Team on Vercel.
A member of the Team first needs to authorize it.
this is great - thank you! โค๏ธ
would you add unit tests in
ssr.test.tsandno-ssr.test.ts, e.g.:https://github.com/nuxt/image/blob/aaeb7d5cfafc0a2ce5a4feea0a9486a177876363/test/e2e/ssr.test.ts#L58-L72
Thank you for the feedback, I couldn't get e2e test to run on my end, not sure if I setup something wrong, I'm using github codespaces to work on the PR
fixed the test suite! you should be able to run e2e tests now....
Codecov Report
:x: Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 7.03%. Comparing base (bf778b5) to head (165ae13).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/module.ts | 0.00% | 21 Missing :warning: |
| src/ipx.ts | 0.00% | 3 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1880 +/- ##
========================================
- Coverage 7.06% 7.03% -0.03%
========================================
Files 77 77
Lines 3555 3569 +14
Branches 138 138
========================================
Hits 251 251
- Misses 3256 3270 +14
Partials 48 48
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
apologize for slow update on PR, was busy with work for the last month and now got the time to add test into it
The latest updates on your projects. Learn more about Vercel for Git โ๏ธ
1 Skipped Deployment
| Name | Status | Preview | Updated (UTC) |
|---|---|---|---|
| image-docus | โฌ๏ธ Ignored (Inspect) | Aug 4, 2025 10:46am |