Skip to content

[BUG] - Module not found: Error: Can't resolve '@micro-sentry/core' (webpack 4 & micro-sentry 5-6) #36

Open
tmns opened this issue Sep 24, 2022 · 0 comments
Assignees

Comments

@tmns
Copy link

tmns commented Sep 24, 2022

🐞 Bug report

Description

Hey all, first thanks for the work on this library -- it's an absolute life saver!

I'm currently using the vanilla version (though in a React app), @micro-sentry/browser, and in versions 5 & 6, I get the following error during build (with webpack):

ERROR in ./node_modules/@micro-sentry/browser/fesm2015/micro-sentry-browser.mjs
Module not found: Error: Can't resolve '@micro-sentry/core' in '/home/projects/github-x25w5q/node_modules/@micro-sentry/browser/fesm2015'
 @ ./node_modules/@micro-sentry/browser/fesm2015/micro-sentry-browser.mjs 1:0-65 16:39-56 562:23-31
 @ ./src/index.js

ERROR in chunk main [entry]
main.js
/home/projects/github-x25w5q/src/index.js 848129bca480294ec4fa1da45f08ffd4
Unexpected token (17:39)
|     return window;
| }
| class BrowserMicroSentryClient extends !(function webpackMissingModule() { var e = new Error("Cannot find module '@micro-sentry/core'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()) {
|     constructor(options, window = getWindow()) {
|         super(options);

For some reason it looks like it can't resolve @micro-sentry/core from within that file, even though it's definitely been installed. On my end it looks like there may be a conflict with Webpack 4. When I test it in Webpack 5 it works as expected. Unfortunately though I have to use Webpack 4 IRL.

Luckily, version 4 of micro-sentry works fine; so I can use that, but just wanted to raise it here as eventually it would be nice to be able to use a version that doesn't include tslib too.

Any help would be great!

Reproduction

  1. Open up the following Stackblitz: https://stackblitz.com/edit/github-x25w5q?file=src/index.js
  2. In the terminal run webpack
  3. Observe the error

Expected behavior

To successfully build!

Versions

  • @micro-sentry/browser versions 5 and up
  • webpack version 4.46.0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants