Skip to content

Why next.js source maps are in ES5 #953

@vladinko0

Description

@vladinko0

I would like to have correct crash reports from Sentry lib to show exact place of error in original code.
But looks like source maps for web are not showing original code but ES5.

Screenshot 2022-12-23 at 15 20 32

Is it possible to reconfigure maybe settings in next.config.js in order source maps were showing original code?

next.config.js:

const { withRNV } = require('@rnv/engine-rn-next');
const path = require('path');
const fs = require('fs');
const cp = require('child_process');

const config = {
    compress: false,
    webpack: (cfg, { isServer }) => {
        if (!isServer) cfg.resolve.alias['@sentry/node'] = '@sentry/browser';
        cfg.module.rules.push({
            test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
            use: {
                loader: 'url-loader',
                options: {
                    limit: 100000,
                    name: '[name].[ext]',
                },
            },
        });
        return cfg;
    },
    typescript: {
        ignoreBuildErrors: true,
    },
    publicRuntimeConfig: {
        deployEnv: process.env.DEPLOY_ENV || 'Development',
        customScripts: [],
    },
    images: {
        loader: 'akamai',
        path: '',
    },
    async headers() {
        return [
            {
                source: '/(.*)',
                headers: [
                    {
                        key: 'X-Application-Version',
                        value: getPackageVersion(),
                    },
                    {
                        key: 'access-control-allow-origin',
                        value: '*',
                    },
                ],
            },
        ];
    },
    experimental: {
        outputStandalone: true,
    },
    productionBrowserSourceMaps: true,
};

module.exports = withRNV(config, {
    enableNextCss: false,
    enableOptimizedImages: true,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionI have a question!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions