Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(vite, webpack): allow client-side sourcemaps in production #7313

Merged
merged 10 commits into from
Sep 7, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Sep 7, 2022

πŸ”— Linked issue

resolves nuxt/nuxt#14823

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR bundles a couple of changes to sourcemap handling:

  1. fixes a bug where nitro sourcemaps were not respecting sourcemap config (a typo)
  2. generates client-side sourcemaps for webpack/vite in production if sourcemap is set to true (or allows either falling back to previous behaviour with new option 'server' or generating only client-side sourcemaps with 'client')
  3. defaults to previous behaviour (generates all sourcemaps in dev, and only server-side sourcemaps in production)
  4. fixes (unrelated) issue with perf(nuxt): tree-shake client-only components from ssr bundleΒ #5750 where client-only components were being tree-shaken out of client build as well πŸ™ˆ

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added bug Something isn't working nitro vite webpack 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Sep 7, 2022
@danielroe danielroe requested a review from pi0 September 7, 2022 09:47
@danielroe danielroe self-assigned this Sep 7, 2022
@netlify
Copy link

netlify bot commented Sep 7, 2022

βœ… Deploy Preview for nuxt3-docs ready!

Name Link
πŸ”¨ Latest commit 71f48fb
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/63188050ad56d50008f53597
😎 Deploy Preview https://deploy-preview-7313--nuxt3-docs.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@danielroe danielroe requested a review from pi0 September 7, 2022 11:12
packages/vite/src/server.ts Outdated Show resolved Hide resolved
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

LGTM. refactor note: i was thinking false | { client, server } from resolved options is more convenient but we can do it later if there are more client || server conditions needed to enable sourcemap for plugins...

@pi0 pi0 merged commit eab4706 into main Sep 7, 2022
@pi0 pi0 deleted the fix/public-sourcemaps branch September 7, 2022 11:32
This was referenced Sep 9, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working nitro 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing vite webpack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nuxt generate won't output javascript source maps
2 participants