tldraw/packages/www/next.config.js
Steve Ruiz 99730b4fe2
[feature] MVP multiplayer support (#135)
* Adds multiplayer support

* Update liveblocks.tsx

* Update liveblocks.tsx

* Create chaos.tsx

* Fix undo redo, add merge state

* Update multiplayer-editor.tsx

* Adds secret room

* Update chaos.tsx

* Moves shhh to shhhmp

* Fix accidentally deleting the editing shape

* Fix bug where a selected shape is deleted by another user.

* Remove relative path

* Tweak editor

* Remove chaos endpoint

* Adds error state for maximum connections, fixes selectedIds bug on new rooms
2021-10-09 00:05:24 +01:00

75 lines
1.8 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
const withPWA = require('next-pwa')
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const withTM = require('next-transpile-modules')(['@tldraw/tldraw', '@tldraw/core'])
const {
GITHUB_ID,
GITHUB_SECRET,
GITHUB_API_SECRET,
NEXT_PUBLIC_SENTRY_DSN: SENTRY_DSN,
SENTRY_ORG,
SENTRY_PROJECT,
SENTRY_AUTH_TOKEN,
NODE_ENV,
VERCEL_GIT_COMMIT_SHA,
GA_MEASUREMENT_ID,
} = process.env
process.env.SENTRY_DSN = SENTRY_DSN
const isProduction = NODE_ENV === 'production'
const basePath = ''
module.exports = withPWA(
withTM({
reactStrictMode: true,
pwa: {
disable: !isProduction,
dest: 'public',
},
productionBrowserSourceMaps: true,
env: {
NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA,
GA_MEASUREMENT_ID,
GITHUB_ID,
GITHUB_SECRET,
GITHUB_API_SECRET,
},
webpack: (config, options) => {
if (!options.isServer) {
config.resolve.alias['@sentry/node'] = '@sentry/browser'
}
config.plugins.push(
new options.webpack.DefinePlugin({
'process.env.NEXT_IS_SERVER': JSON.stringify(options.isServer.toString()),
})
)
if (
SENTRY_DSN &&
SENTRY_ORG &&
SENTRY_PROJECT &&
SENTRY_AUTH_TOKEN &&
VERCEL_GIT_COMMIT_SHA &&
isProduction
) {
config.plugins.push(
new SentryWebpackPlugin({
include: '.next',
ignore: ['node_modules'],
stripPrefix: ['webpack://_N_E/'],
urlPrefix: `~${basePath}/_next`,
release: VERCEL_GIT_COMMIT_SHA,
authToken: SENTRY_AUTH_TOKEN,
org: SENTRY_PROJECT,
project: SENTRY_ORG,
})
)
}
return config
},
})
)