airbrake / airbrake-js

Airbrake JavaScript Notifier
https://airbrake.io
MIT License
422 stars 139 forks source link

Webpack attempting to load Typescript declaration files and maps during compilation #935

Closed charle692 closed 3 years ago

charle692 commented 3 years ago

🐞 bug report

Affected Package

The issue is caused by package @airbrake/node

Is this a regression?

Not entirely sure about this part, I guess no? But this was not previously an issue in earlier versions such as 1.0.1. Once the automatic instrumentation was added this became an issue.

I've only recently tried to use this package but found that I couldn't.

Description

Whenever attempting to compile a Typescript express app that uses @airbrake/node, I get the specified warnings in console.

The reason for this is because of the require statement in notifier.ts does not specify a file extension and so webpack attempts to load all files including .d.ts, .d.ts.map.

πŸ”¬ Minimal Reproduction

If a reproduction is required for this I will make one otherwise I will create an MR to address the issue.

πŸ”₯ Exception or Error


WARNING in /Users/xxx/node_modules/@airbrake/node/esm/notifier.js 161:26-42
Critical dependency: the request of a dependency is an expression
 @ /Users/xxx/node_modules/@airbrake/node/esm/index.js
 @ ...

WARNING in /Users/xxx/node_modules/@airbrake/node/dist/instrumentation/debug.d.ts.map 1:10
Module parse failed: Unexpected token (1:10)
File was processed with these loaders:
 * ../../node_modules/cache-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
> {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/instrumentation/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,wBAAgB,KAAK,CAAC,WAAW,KAAA,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAc3D"}
 @ /Users/xxx/node_modules/@airbrake/node/dist/instrumentation sync ^\.\/.*$ ./debug.d.ts.map
 @ /Users/xxx/node_modules/@airbrake/node/esm/notifier.js
 @ /Users/xxx/node_modules/@airbrake/node/esm/index.js

🌍 Your Environment

@airbrake/* version:


"@airbrake/node@^1.4.2":
  version "1.4.2"

Anything else relevant?

Webpack v4.44.1 but I'm fairly confident it's not version specific.

kyrylo commented 3 years ago

Fixed by https://github.com/airbrake/airbrake-js/pull/936.