mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(sentry): add wip sentry integration on server side
This commit is contained in:
1 parent
4b724dfa73
commit
02f0abd761
10 files changed
+330
-64
No files matched your search
+89
-55
@@ -1,21 +1,12 @@
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const RemovePlugin = require('remove-files-webpack-plugin');
|
||||
|
||||
const SentryCliPlugin = require('@sentry/webpack-plugin');
|
||||
const { RewriteFrames } = require('@sentry/integrations');
|
||||
const buildPath = path.resolve(__dirname, 'dist');
|
||||
|
||||
const server = {
|
||||
entry: './server/server.ts',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: ['ts-loader'],
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
const server = () => {
|
||||
const plugins = [
|
||||
new RemovePlugin({
|
||||
before: {
|
||||
include: [path.resolve(buildPath, 'server')],
|
||||
@@ -26,51 +17,94 @@ const server = {
|
||||
}),
|
||||
// Ignore cardinal as its optional
|
||||
new webpack.IgnorePlugin(/^cardinal$/, /./),
|
||||
],
|
||||
optimization: {
|
||||
minimize: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
output: {
|
||||
filename: '[contenthash].server.js',
|
||||
path: path.resolve(buildPath, 'server'),
|
||||
},
|
||||
target: 'node',
|
||||
];
|
||||
|
||||
if (process.env.IS_SENTRY) {
|
||||
plugins.push(
|
||||
new SentryCliPlugin({
|
||||
url: 'https://sentry.projecterror.dev',
|
||||
release: process.env.npm_package_version,
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||
org: 'project-error',
|
||||
project: 'npwd-s',
|
||||
include: ['dist/server'],
|
||||
ignore: ['node_modules'],
|
||||
validate: true,
|
||||
integrations: [
|
||||
new RewriteFrames({
|
||||
// root: rootDir,
|
||||
// iteratee: (frame) => {
|
||||
// if (!frame.filename || frame.filename === '') return frame;
|
||||
//
|
||||
// frame.filename = frame.filename = frame.filename.replace('@npwd', '');
|
||||
// return frame;
|
||||
// },
|
||||
}),
|
||||
],
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
entry: './server/server.ts',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: ['ts-loader'],
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins,
|
||||
devtool: 'source-map',
|
||||
optimization: {
|
||||
minimize: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
output: {
|
||||
filename: '[contenthash].server.js',
|
||||
path: path.resolve(buildPath, 'server'),
|
||||
},
|
||||
target: 'node',
|
||||
};
|
||||
};
|
||||
|
||||
const client = {
|
||||
entry: './client/client.ts',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: ['ts-loader'],
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
const client = () => {
|
||||
return {
|
||||
entry: './client/client.ts',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: ['ts-loader'],
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new RemovePlugin({
|
||||
before: {
|
||||
include: [path.resolve(buildPath, 'client')],
|
||||
},
|
||||
watch: {
|
||||
include: [path.resolve(buildPath, 'client')],
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new RemovePlugin({
|
||||
before: {
|
||||
include: [path.resolve(buildPath, 'client')],
|
||||
},
|
||||
watch: {
|
||||
include: [path.resolve(buildPath, 'client')],
|
||||
},
|
||||
}),
|
||||
],
|
||||
optimization: {
|
||||
minimize: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
output: {
|
||||
filename: '[contenthash].client.js',
|
||||
path: path.resolve(buildPath, 'client'),
|
||||
},
|
||||
optimization: {
|
||||
minimize: true,
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.tsx', '.ts', '.js'],
|
||||
},
|
||||
output: {
|
||||
filename: '[contenthash].client.js',
|
||||
path: path.resolve(buildPath, 'client'),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = [server, client];
|
||||
Reference in new issue
Block a user