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

Production source maps show webpack-generated files rather than source files in 10.0.4 #20500

Closed
kachkaev opened this issue Dec 26, 2020 · 2 comments · Fixed by #20672
Closed
Assignees
Milestone

Comments

@kachkaev
Copy link
Contributor

kachkaev commented Dec 26, 2020

Bug report

Describe the bug

Looks like something is wrong with the productionBrowserSourceMaps option, which was moved out from experimental in v10.0.4 (#20267). Instead of displaying what developers have in the editor, they resolve into some intermedeate webpack output.

To Reproduce

  1. Create an app

    npx create-next-app next-production-source-maps-mvp
    cd next-production-source-maps-mvp
    yarn why next
    ## => Found "[email protected]"
  2. Enable productionBrowserSourceMaps (as suggested by docs)

    cat <<EOF >next.config.js
    module.exports = { productionBrowserSourceMaps: true }
    EOF
  3. Build and start

    yarn build && yarn start
  4. Open the browser and observe

    • Raw source (pointing to a source map as expected):
      producion (raw source)

    • Source map (resolved and downloaded, but is not very helpful):
      production source map (broken)

Expected behavior

I was expecting the source maps for yarn build && yarn start to look the same as for yarn dev:

development source map (looking good)

Seeing jsx, original file paths and unchanged js / ts syntax is crucial for debugging.

System information

  • OS: macOS 11
  • Browser (if applies) Chrome / Firefox
  • Version of Next.js: 10.0.4
  • Version of Node.js: 14.15.3
  • Deployment: local (also observed on vercel for njt.now.sh)

Additional context

Switching to @zeit/next-source-maps (which the new option is aiming to replace) gives the same incorrect result in Next 10.0.4. Here are the additional repro steps to observe this:

yarn add -D @zeit/next-source-maps

cat <<EOF >next.config.js
const withSourceMaps = require('@zeit/next-source-maps')
module.exports = withSourceMaps()
EOF

yarn build && yarn start

What helps is downgrading to Next 10.0.3 and either keeping @zeit/next-source-maps or setting the experimental option:

yarn add [email protected]

cat <<EOF >next.config.js
module.exports = { experimental: { productionBrowserSourceMaps: true } }
EOF

yarn build && yarn start

production and experimental flag in version 10.0.3

@kachkaev kachkaev added the bug Issue was opened via the bug report template. label Dec 26, 2020
@kachkaev
Copy link
Contributor Author

kachkaev commented Dec 26, 2020

I tried walking through all canary versions between 10.0.3 and 10.0.4 after making next.config.js agnostic to #20267:

module.exports = { productionBrowserSourceMaps: true, experimental: { productionBrowserSourceMaps: true } }

Source maps work as in 10.0.3 up until [email protected], but then switch to the broken behaviour in [email protected]. Looking at the release notes for canary.5, can the bug be caused by #20089? It must have went under the radars because the source maps were not gone anywhere, they just changed content-wise.

@Timer Timer added kind: bug and removed bug Issue was opened via the bug report template. labels Dec 28, 2020
@Timer Timer added this to the iteration 15 milestone Dec 28, 2020
@Timer Timer self-assigned this Dec 31, 2020
@Timer Timer added the point: 2 label Jan 1, 2021
@kodiakhq kodiakhq bot closed this as completed in #20672 Jan 1, 2021
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants