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

[Bug] @sentry/webpack-plugin 报 TypeError: e is not a constructor 错误 #12782

Open
qingbopro opened this issue Nov 14, 2024 · 0 comments
Open

Comments

@qingbopro
Copy link

What happens?

umi config通过chainWebpack配置sentry上传sourcemap插件,执行pnpm build报错

配置信息

import { sentryWebpackPlugin as SentryWebpackPlugin } from '@sentry/webpack-plugin';
import { defineConfig } from '@umijs/max';

import proxy from './proxy';
import routes from './routes';

const { REACT_APP_ENV = 'dev' } = process.env;
const config: ReturnType = defineConfig({
hash: true,
devtool: 'source-map',
chainWebpack(memo) {
memo.plugin('sentry').use(SentryWebpackPlugin, [
{
authToken: 'xxx',
org: 'xxx',
project: 'data-center',
url: 'http://xxx:9000/',
sourcemaps: {
filesToDeleteAfterUpload: ['dist//*.map'],
},
release: {
name: '[email protected]',
},
},
]);
return memo;
},
favicons: ['/favicon.png'],
tailwindcss: {},
routes,
ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV as keyof typeof proxy],
fastRefresh: true,
model: {},
initialState: {},
layout: {
locale: false,
},
moment2dayjs: {
preset: 'antd',
plugins: ['duration'],
},
request: {
dataField: 'data',
},
access: {},
headScripts: [
],
presets: ['umi-presets-pro'],
mock: {
include: ['mock/
/*', 'src/pages/**/_mock.ts'],
},
mfsu: {
strategy: 'normal',
},
esbuildMinifyIIFE: true,
requestRecord: {},
codeSplitting: {
jsStrategy: 'granularChunks',
},
});
export default config;

报错信息:

fatal - TypeError: e is not a constructor
at /Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected][email protected][email protected]/node_modules/@umijs/bundler-webpack/compiled/webpack-5-chain/index.js:1:19639
at Object.toConfig (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected][email protected][email protected]/node_modules/@umijs/bundler-webpack/compiled/webpack-5-chain/index.js:1:20549)
at /Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected][email protected][email protected]/node_modules/@umijs/bundler-webpack/compiled/webpack-5-chain/index.js:1:13918
at Array.map ()
at e.exports.toConfig (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected][email protected][email protected]/node_modules/@umijs/bundler-webpack/compiled/webpack-5-chain/index.js:1:13908)
at Proxy.getConfig (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected][email protected][email protected]/node_modules/@umijs/bundler-webpack/dist/config/config.js:228:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Proxy.build (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected][email protected][email protected]/node_modules/@umijs/bundler-webpack/dist/build.js:47:25)
at async Command.fn (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs+preset-umi@4.3.27_@types[email protected][email protected][email protected]/node_modules/@umijs/preset-umi/dist/commands/build.js:154:17)
at async Service.run (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/@umijs[email protected]/node_modules/@umijs/core/dist/service/service.js:328:15)
at async Service.run2 (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/umi@4.3.27_@babel+core@7.25.8_@types[email protected][email protected][email protected]_react-dom@18.nj4lktaqyqnlrvqyaeqjlwvsae/node_modules/umi/dist/service/service.js:65:12)
at async run (/Users/edy/Desktop/biz-data-center/node_modules/.pnpm/[email protected]
@babel+core@7.25.8_@types[email protected][email protected][email protected]_react-dom@18._nj4lktaqyqnlrvqyaeqjlwvsae/node_modules/umi/dist/cli/cli.js:56:7)
fatal - A complete log of this run can be found in:
fatal - /Users/edy/Desktop/biz-data-center/node_modules/.cache/logger/umi.log
fatal - Consider reporting a GitHub issue on https://github.com/umijs/umi/issues
fatal - 如果你需要进交流群,请访问 https://fb.umijs.org

How To Reproduce

pnpm build

Context

  • @umijs/max: 4.3.27
  • Node Version: v20.13.1
  • Platform: Mac Intel
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

No branches or pull requests

1 participant