M
M
Maxim Donskov2018-12-04 15:06:09
JavaScript
Maxim Donskov, 2018-12-04 15:06:09

Why doesn't Sentry work after webpack build?

My project uses webpack v3.7.1, with the following settings:

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

let config = {
     // подключение других менее критичных настроек...
    output: {
        path: path.join(__dirname, 'dist'),
        filename: "./js/[name].js",
        sourceMapFilename: "./js/[name].js.map"
    },

    devtool: 'source-map',

    plugins: [
        new SentryWebpackPlugin({
            include: '.',
            ignoreFile: '.sentrycliignore',
            ignore: ['node_modules', 'webpack.config.js'],
            configFile: 'sentry.properties'
        })
    ],
};

module.exports (env) = {
    // подключение других менее критичных настроек...

    if (env.production) {
        config = merge(config, {
            plugins: [
                new UglifyJSPlugin({
                    sourceMap: true,
                    beautify: false,
                    comments: false,
                    compress: {
                        sequences: true,
                        booleans: true,
                        loops: true,
                        unused: true,
                        warnings: false,
                        drop_console: false,
                        unsafe: true
                    }
                }),
                new webpack.DefinePlugin({
                    'process.env': {
                        NODE_ENV: JSON.stringify('production')
                    }
                })
            ]
        });
    }

    if (env.development) {
        config = merge(config, {
            devServer: {
                contentBase: `../${dist.root}`,
                watchContentBase: true,
                openPage: '/pages-list.html',
                open: true,
                port: '3003'
            }
        });
    }
};

accordingly, the connection of the sentry itself in the project happens like this:
import * as Sentry from '@sentry/browser';

Sentry.init(Object.assign({
    dsn: 'self_hosted_sentry_url',
    environment: 'development', // соответственно для продакшена - 'production'
    integrations: [
        new Sentry.Integrations.Vue({ Vue })
    ]
}, config));

And here is the question, when I run webpack in dev-server mode or in watch-mode, then errors are generated and fly away to Sentry correctly. But as soon as I build the project for production, then all the errors that flew away in development mode stop flying away. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question