Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Webpack Next.js Sentry Sourcemap大小太大_Webpack_Next.js_Source Maps_Sentry_Vercel - Fatal编程技术网

Webpack Next.js Sentry Sourcemap大小太大

Webpack Next.js Sentry Sourcemap大小太大,webpack,next.js,source-maps,sentry,vercel,Webpack,Next.js,Source Maps,Sentry,Vercel,我正试图使用next.js的sourcemap功能来更好地调试sentry,但当我构建下一个应用程序时,它试图将大型sourcemap文件上传到sentry。有什么问题吗 另外,我的next.config.js配置如下 const SentryWebpackPlugin = require('@sentry/webpack-plugin'); const withSourceMaps = require('@zeit/next-source-maps')(); webpack: (confi

我正试图使用next.js的sourcemap功能来更好地调试sentry,但当我构建下一个应用程序时,它试图将大型sourcemap文件上传到sentry。有什么问题吗

另外,我的next.config.js配置如下

const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const withSourceMaps = require('@zeit/next-source-maps')();

webpack: (config, { dev, isServer, buildId }) => {
    if (!isServer) {
      config.resolve.alias['@sentry/node'] = '@sentry/browser';
    }
    if (process.env.NODE_ENV === 'production') {
      config.plugins.push(
        new SentryWebpackPlugin({
          include: './app/.next',
          ignore: ['node_modules'],
          urlPrefix: '~/_next',
          release: buildId,
        }),
      );
    }

    return config;}
  • npm删除@zeit/next源映射
  • npm inext@latest
  • nextjs现在具有内置配置,可以在生产环境中启用源映射 我还建议忽略哨兵不需要的
    *.css.map
    和其他文件,所以不要上传它们

    const SentryWebpackPlugin = require('@sentry/webpack-plugin');
    
    ...
    module.exports = {
    ...
    productionBrowserSourceMaps: process.env.NODE_ENV === 'production',
    ...
    webpack: (config, { dev, isServer, buildId }) => {
        if (!isServer) {
          config.resolve.alias['@sentry/node'] = '@sentry/browser';
        }
        if (process.env.NODE_ENV === 'production') {
          config.plugins.push(
            new SentryWebpackPlugin({
              include: './app/.next',
              ignore: ['node_modules', '*.css.map'],
              stripPrefix: ['webpack://_N_E/'],
              urlPrefix: '~/_next',
              release: buildId,
            }),
          );
        }
    
        return config;
    }