Skip to content

ref(nextjs): Move config code to SDK and fix next version bug #3418

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

Merged
merged 5 commits into from
Apr 20, 2021

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Apr 20, 2021

Two changes here:

  • Cramer reported running into trouble because he hadn't specified the next version in his project's package.json exactly, and as a result, the version we copy over to our plugin didn't match what next was expecting. ('^10.1.3' didn't match ''10.1.3', and neither did 10.x.) To avoid such problems, the version number we copy over is now drawn from the version value in next's package.json rather than the dependencies.next value in the project's package.json.

  • He also mentioned it would be nice to abstract away as much of the boilerplate config code as we could, and since this was something we as a team had already identified as something we'd like to do, I went ahead and did it. Also, in order for it to be possible to use SDK code in next.config.js (which is vanilla JS), it was necessary to add an ES5 build and a main entry in package.json.

A word of caution when testing this - if you pull the branch and use your linked packages in a test app, it will fail, because the relative paths will anchor themselves in your repo rather than your test app. My solution has been to leave everything linked, and then mv node_modules/@sentry node_modules/@sentry-linked && cp -r node_modules/@sentry-linked node_modules/@sentry, which will create non-sym-linked versions of all of the packages. (Fun fact, using Duplicate in the Finder - I know, I know, it's sacrilege, but I got lazy - just gives you another set of sym-links, not a copy of those links' targets.)

This PR is in coordination with this PR in the wizard and this commit in docs.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 20, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 20.6 KB (0%)
@sentry/browser - Webpack 21.48 KB (0%)
@sentry/react - Webpack 21.52 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 27.82 KB (+0.01% 🔺)

@iker-barriocanal iker-barriocanal merged commit 2f3355e into feat/next-js Apr 20, 2021
@iker-barriocanal iker-barriocanal deleted the kmclb-next-config-js-fixes branch April 20, 2021 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants