Skip to content

Commit

Permalink
Add sentry config for Sourcemap (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyash97 authored and metagrover committed Dec 3, 2018
1 parent de9ca22 commit 1430ecc
Show file tree
Hide file tree
Showing 4 changed files with 1,998 additions and 3,644 deletions.
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -8,8 +8,8 @@
"license": "MIT",
"private": false,
"scripts": {
"start": "webpack-dev-server --mode development --content-base . --history-api-fallback --hot --inline --progress --colors --port 1357",
"build": "webpack --mode production",
"start": "NODE_ENV=development webpack-dev-server --mode development --content-base . --history-api-fallback --hot --inline --progress --colors --port 1357",
"build": "NODE_ENV=production node ./scripts/create-env.js && webpack --mode production",
"glow": "glow --watch",
"lint": "eslint ."
},
Expand All @@ -24,6 +24,7 @@
"@babel/preset-env": "^7.0.0-rc.1",
"@babel/preset-flow": "^7.0.0-rc.1",
"@babel/preset-react": "^7.0.0-rc.1",
"@sentry/webpack-plugin": "^1.6.1",
"babel-eslint": "^8.2.6",
"babel-loader": "^8.0.0-beta",
"babel-plugin-emotion": "^9.2.6",
Expand Down
8 changes: 8 additions & 0 deletions scripts/create-env.js
@@ -0,0 +1,8 @@
const fs = require('fs');

fs.writeFileSync(
'./.env',
`SENTRY_AUTH_TOKEN=${
process.env.SENTRY_TOKEN
}\nSENTRY_URL=https://sentry.io/\nSENTRY_ORG=appbase-1\nSENTRY_PROJECT=frontend\n`,
);
12 changes: 12 additions & 0 deletions webpack.config.js
@@ -1,4 +1,7 @@
const path = require('path');
const SentryPlugin = require('@sentry/webpack-plugin');

const isProduction = String(process.env.NODE_ENV) === 'production';

module.exports = {
entry: path.join(__dirname, 'src/index.js'),
Expand All @@ -8,6 +11,15 @@ module.exports = {
filename: 'build.js',
chunkFilename: '[name].[contenthash].build.js',
},
plugins: isProduction
? [
new SentryPlugin({
include: './dist',
ignore: ['node_modules', 'webpack.config.js'],
configFile: './.env',
}),
] // prettier-ignore
: [],
module: {
rules: [
{
Expand Down

0 comments on commit 1430ecc

Please sign in to comment.