Skip to content

Commit

Permalink
Merge pull request #970 from woowacourse-teams/FE/dev
Browse files Browse the repository at this point in the history
[FE] 🚀 Netlify 배포 테스트
  • Loading branch information
anttiey authored Nov 25, 2024
2 parents 5cf3522 + c1fda4a commit 383d634
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import './styles/font.css';

if (process.env.NODE_ENV === 'production') {
Sentry.init({
dsn: process.env.SENTRY_DSN,
dsn: process.env.REACT_APP_SENTRY_DSN,
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
tracesSampleRate: 1.0,
tracePropagationTargets: ['localhost:3001', 'https://coduo.site', /^\/api\//],
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
if (process.env.GA_TRACKING_ID) ReactGA.initialize(process.env.GA_TRACKING_ID);
if (process.env.REACT_APP_GA_TRACKING_ID) ReactGA.initialize(process.env.REACT_APP_GA_TRACKING_ID);
}

ReactDOM.createRoot(document.getElementById('root')!).render(
Expand Down
25 changes: 11 additions & 14 deletions frontend/webpack.production.config.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { merge } from 'webpack-merge';
import common from './webpack.common.config.js';
import { sentryWebpackPlugin } from '@sentry/webpack-plugin';
import dotenv from 'dotenv';
import webpack from 'webpack';
import pkg from './package.json' with { type: 'json' };

const env = dotenv.config({ path: '.env' }).parsed;

const envKeys = env
? Object.keys(env).reduce((prev, next) => {
prev[`process.env.${next}`] = JSON.stringify(env[next]);
return prev;
}, {})
: {};
const envKeys = {
'process.env.REACT_APP_API_URL': JSON.stringify(process.env.REACT_APP_API_URL),
'process.env.REACT_APP_SENTRY_AUTH_TOKEN': JSON.stringify(process.env.REACT_APP_SENTRY_AUTH_TOKEN),
'process.env.REACT_APP_SENTRY_DSN': JSON.stringify(process.env.REACT_APP_SENTRY_DSN),
'process.env.REACT_APP_GA_TRACKING_ID': JSON.stringify(process.env.REACT_APP_GA_TRACKING_ID),
'process.env.REACT_APP_CLIENT_ID': JSON.stringify(process.env.REACT_APP_CLIENT_ID),
'process.env.REACT_APP_GITHUB_AUTH': JSON.stringify(process.env.REACT_APP_GITHUB_AUTH),
'process.env.REACT_APP_VERSION': JSON.stringify(pkg.version),
};

export default merge(common, {
mode: 'production',
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin(envKeys),
sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
authToken: process.env.REACT_APP_SENTRY_AUTH_TOKEN,
org: '2024-coduo',
project: 'coduo2024',
release: 'Coduo' + process.env.REACT_APP_VERSION,
Expand All @@ -31,10 +32,6 @@ export default merge(common, {
include: './dist',
ignore: ['node_modules'],
}),
new webpack.DefinePlugin({
...envKeys,
REACT_APP_VERSION: pkg.version,
}),
],
optimization: {
minimize: true,
Expand Down

0 comments on commit 383d634

Please sign in to comment.