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

fix: make rollbar compatible with webpack #936

Closed
wants to merge 1 commit into from

Conversation

andrei-bitca-dc
Copy link

Description of the change

Rollbar is not working when using @vercel/ncc to build. It points to the project package.json, instead of rollbar's one, therefore getting:

TypeError: Cannot read property 'server' of undefined at Object.3029 (/var/webpack:/node_modules/rollbar/src/server/rollbar.js:659:1)

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request


var packageJson = require('../../package.json');
var packageJson = require(path.join(__dirname, '../../package.json'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the path only resolve incorrectly here, and not for any of the following relative paths?

Copy link
Author

Choose a reason for hiding this comment

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

I think because it's the package.json file and it's not included in the dist.

Copy link
Author

Choose a reason for hiding this comment

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

However, using path.join for dynamic imports won't work with esbuild, as it doesn't support dynamic imports yet (evanw/esbuild#700).

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.

None yet

2 participants