question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect type definition

See original GitHub issue

In @sentry/webpack-plugin@1.11.1, the type definition in index.d.ts and the module in src/index.js do not match.

The type definition states that SentryCliPlugin is the default export for the module, but in index.js, SentryCliPlugin is simply assigned to module.exports.

Related to #144 and #145 .

I believe the solution is to change index.js as follows:

module.exports.default = SentryCliPlugin;

and leave index.d.ts as-is.

Example usage with TypeScript:

import SentryCliPlugin from '@sentry/webpack-plugin';

const config = {
  plugins: [
    new SentryCliPlugin({...}),
  ],
};

Example usage with JavaScript (note the addition of .default on the require line):

const SentryCliPlugin = require('@sentry/webpack-plugin').default;

const config = {
  plugins: [
    new SentryCliPlugin({...}),
  ],
};

The alternative would be to change SentryCliPlugin to a named export.

Current workaround

TypeScript users must instruct TypeScript to ignore the false error:

import { Configuration } from 'webpack';
import * as SentryCliPlugin from '@sentry/webpack-plugin';

const config: Configuration = {
  plugins: [
    // @ts-ignore
    new SentryCliPlugin({...})
  ]
};

export default config;

Minor side note: The documentation page for source maps appears to be out-of-date as it references SentryWebpackPlugin from this package rather than SentryCliPlugin.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilogorekcommented, May 13, 2020

Thanks! I’ll merge #190 after a review. Cheers!

0reactions
mjswensencommented, May 12, 2020

Thanks for the reply @kamilogorek . We ended up simply publishing our source maps publicly as that was more straightforward and has a few other benefits for us. But after a cursory look at #190 I suspect that you are right that it would solve the problem. Feel free to close this and #189 , and thanks again for your work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to overwrite incorrect TypeScript type definition installed ...
Should I just copy the downloaded type definition to another file, update it manually and uninstall @types/dotenv? Is there a better way?
Read more >
CWE-704: Incorrect Type Conversion or Cast (4.9) - MITRE
CWE-704: Incorrect Type Conversion or Cast ; ParentOf, Variant - a weakness that is linked to a certain type of product, typically involving...
Read more >
SAP message GB027 Exit & has the incorrect type
The exit type of the system exit or user exit cannot be used in this condition. This may be the case, if: in...
Read more >
TypeScript. How to rewrite type definition file (file.d.ts) of any ...
How to rewrite type definition file (file.d.ts) of any node_modules package. If you have some node_modules package with the very old /odd /...
Read more >
Type 1 Error: Definition, False Positives, and Examples
This "false positive," leading to an incorrect rejection of the null hypothesis, is called a type I error. A type I error rejects...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found