diff --git a/.env b/.env deleted file mode 100644 index 548ee17aa..000000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -SENTRY_DSN=https://e47a6d214ae4478b81136c29612003a7@sentry.io/1911455 diff --git a/src/index.js b/src/index.js index 66c2ab1f9..24f9ad414 100755 --- a/src/index.js +++ b/src/index.js @@ -3,6 +3,8 @@ const ReactDOM = require('react-dom'); const Sentry = require('@sentry/browser'); const App = require('./App'); -Sentry.init({ dsn: process.env.SENTRY_DSN }); +if (typeof process.env.SENTRY_DSN === 'string') { + Sentry.init({ dsn: process.env.SENTRY_DSN }); +} ReactDOM.render(, document.getElementById('app')); diff --git a/webpack.config.js b/webpack.config.js index f780a2b31..cf679670e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,13 +1,12 @@ const path = require('path'); const webpack = require('webpack'); -const dotenv = require('dotenv').config(); const HtmlWebPackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); -module.exports = { +module.exports = (env, argv) => ({ entry: './src/index.js', output: { path: path.join(__dirname, 'build') @@ -129,7 +128,10 @@ module.exports = { ] }, plugins: [ - new webpack.EnvironmentPlugin(dotenv.parsed), + new webpack.EnvironmentPlugin({ + DEBUG: argv.mode !== 'production', + ...env + }), new webpack.ProgressPlugin(), new CopyWebpackPlugin([ { from: 'node_modules/stremio-core-web/static', to: '' }, @@ -147,4 +149,4 @@ module.exports = { cleanAfterEveryBuildPatterns: ['./main.js', './main.css'] }) ] -}; +});