I am having trouble getting my source maps to work correctly. I am using webpack to compile my source code using the -p option. In my sentry events, it says: Cannot expand sourcemap due to no column information
I’ve tried running my code through the sourcemap validator.
You can see it here: https://sourcemaps.io/validate?url=https%3A%2F%2Fapp.startegy.com%2F1.ca3a11f04f617179e852.chunk.js
I get 1000 errors and 1000 warnings.
If I open my source code in google chrome, the source maps all appear to work correctly.
Here is my webpack config:
const { join } = require('path');
const webpack = require('webpack');
const path = require('path');
const fs = require('fs');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'babel-polyfill',
path.join(process.cwd(), 'app/app.js'),
],
output: {
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].chunk.js',
path: join(process.cwd(), 'public'),
publicPath: '/',
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.jsx?$/,
use: [
{
loader: 'babel-loader',
query: {
babelrc: false,
presets: [
'flow',
['es2015', { modules: false }],
'stage-0',
'react',
],
plugins: [
'syntax-dynamic-import',
'styled-components',
'transform-react-remove-prop-types',
'transform-react-constant-elements',
'transform-react-inline-elements'
],
},
},
],
exclude: /node_modules/,
}, {
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
use: [
'graphql-tag/loader',
],
}, {
test: /\.css$/,
include: /node_modules/,
loaders: ['style-loader', 'css-loader'],
}, {
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
}, {
test: /\.(jpg|png|gif|webp)$/,
loader: 'file-loader',
},
],
},
plugins: [
new webpack.IgnorePlugin(/\.\/locale$/),
new HtmlWebpackPlugin({
template: '!!handlebars-loader!app/index.hbs',
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
},
inject: true,
production: true,
}),
new webpack.ProvidePlugin({
'fetch': 'imports-loader?this=>global!exports-loader?global.fetch!whatwg-fetch',
}),
new webpack.optimize.CommonsChunkPlugin({
children: true,
minChunks: 2,
async: true,
}),
],
resolve: {
modules: ['app', 'node_modules', 'common'],
alias: {
moment: 'moment/min/moment.min',
'fixed-data-table': 'fixed-data-table-2',
},
extensions: [
'.js',
'.jsx',
'.react.js',
],
mainFields: [
'browser',
'jsnext:main',
'main',
],
},
performance: {
assetFilter: (assetFilename) => !(/(\.map$)|(^(main\.|favicon\.))/.test(assetFilename)),
},
};