From e78f9a086a083c3414a87776b9825ead4fd046da Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Wed, 11 May 2022 09:55:31 +0100 Subject: [PATCH] remove transpile modules (#670) * remove transpile modules * remove dependency --- apps/www/next.config.js | 103 ++++++++++++++++----------------- apps/www/package.json | 7 +-- packages/tldraw/src/Tldraw.tsx | 2 +- yarn.lock | 10 +--- 4 files changed, 55 insertions(+), 67 deletions(-) diff --git a/apps/www/next.config.js b/apps/www/next.config.js index 414a455c5..2c5d4f438 100644 --- a/apps/www/next.config.js +++ b/apps/www/next.config.js @@ -1,7 +1,6 @@ /* 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, @@ -21,59 +20,57 @@ 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_API_SECRET, - }, - webpack: (config, options) => { - if (!options.isServer) { - config.resolve.alias['@sentry/node'] = '@sentry/browser' - } +module.exports = withPWA({ + reactStrictMode: true, + pwa: { + disable: !isProduction, + dest: 'public', + }, + productionBrowserSourceMaps: true, + env: { + NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA, + GA_MEASUREMENT_ID, + GITHUB_ID, + 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()), + }) + ) + + config.module.rules.push({ + test: /.*packages.*\.js$/, + use: ['source-map-loader'], + enforce: 'pre', + }) + + if ( + SENTRY_DSN && + SENTRY_ORG && + SENTRY_PROJECT && + SENTRY_AUTH_TOKEN && + VERCEL_GIT_COMMIT_SHA && + isProduction + ) { config.plugins.push( - new options.webpack.DefinePlugin({ - 'process.env.NEXT_IS_SERVER': JSON.stringify(options.isServer.toString()), + 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, }) ) - - config.module.rules.push({ - test: /.*packages.*\.js$/, - use: ['source-map-loader'], - enforce: 'pre', - }) - - 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 - }, - }) -) + } + return config + }, +}) diff --git a/apps/www/package.json b/apps/www/package.json index 4e2ab919a..9312bbdb6 100644 --- a/apps/www/package.json +++ b/apps/www/package.json @@ -29,20 +29,19 @@ "@tldraw/tldraw": "^1.11.1", "@types/next-auth": "^3.15.0", "aws-sdk": "^2.1053.0", + "chrome-aws-lambda": "8.0.2", "next": "^12.0.7", "next-auth": "^4.0.5", "next-pwa": "^5.4.4", "next-themes": "^0.0.15", - "next-transpile-modules": "^9.0.0", - "chrome-aws-lambda": "8.0.2", "puppeteer-core": "9.0.0", "react": "17.0.2", "react-dom": "17.0.2" }, "devDependencies": { + "@sentry/webpack-plugin": "^1.17.1", "@tldraw/core": "*", "@tldraw/tldraw": "*", - "@sentry/webpack-plugin": "^1.17.1", "@types/react": "^17.0.19", "@types/react-dom": "^17.0.9", "cors": "^2.8.5", @@ -51,4 +50,4 @@ "typescript": "^4.5.2" }, "gitHead": "838fabdbff1a66d4d7ee8aa5c5d117bc55acbff2" -} \ No newline at end of file +} diff --git a/packages/tldraw/src/Tldraw.tsx b/packages/tldraw/src/Tldraw.tsx index 70bcc7f54..4023596e7 100644 --- a/packages/tldraw/src/Tldraw.tsx +++ b/packages/tldraw/src/Tldraw.tsx @@ -215,7 +215,7 @@ export function Tldraw({ // Toggle the app's darkMode when the `darkMode` prop changes. React.useEffect(() => { - if (darkMode !== app.settings.isDarkMode){ + if (darkMode !== app.settings.isDarkMode) { app.toggleDarkMode() } }, [app, darkMode]) diff --git a/yarn.lock b/yarn.lock index 27bdaf29d..aba305cbd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5443,7 +5443,7 @@ enhanced-resolve@^5.0.0: graceful-fs "^4.2.4" tapable "^2.2.0" -enhanced-resolve@^5.7.0, enhanced-resolve@^5.8.3: +enhanced-resolve@^5.8.3: version "5.9.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz#49ac24953ac8452ed8fed2ef1340fc8e043667ee" integrity sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA== @@ -8932,14 +8932,6 @@ next-themes@^0.0.15: resolved "https://registry.yarnpkg.com/next-themes/-/next-themes-0.0.15.tgz#ab0cee69cd763b77d41211f631e108beab39bf7d" integrity sha512-LTmtqYi03c4gMTJmWwVK9XkHL7h0/+XrtR970Ujvtu3s0kZNeJN24aJsi4rkZOI8i19+qq6f8j+8Duwy5jqcrQ== -next-transpile-modules@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/next-transpile-modules/-/next-transpile-modules-9.0.0.tgz#133b1742af082e61cc76b02a0f12ffd40ce2bf90" - integrity sha512-VCNFOazIAnXn1hvgYYSTYMnoWgKgwlYh4lm1pKbSfiB3kj5ZYLcKVhfh3jkPOg1cnd9DP+pte9yCUocdPEUBTQ== - dependencies: - enhanced-resolve "^5.7.0" - escalade "^3.1.1" - next@^12.0.7: version "12.1.0" resolved "https://registry.yarnpkg.com/next/-/next-12.1.0.tgz#c33d753b644be92fc58e06e5a214f143da61dd5d"