Incorrect type definition
See original GitHub issueIn @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
.
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:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Thanks! I’ll merge #190 after a review. Cheers!
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.