From e5a5947ca5fab3d24f31b31c9a0098e204bf9aaf Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 9 Jan 2025 12:19:03 +0100 Subject: [PATCH] Replace webpack.config.externals By using `serverExternalPackages`, we should be ready for when we switch to Turbopack. (But we can't switch to Turbopack yet because, as far as I know, it doesn't support require.context yet, which we use for discovering FTL files.) --- next.config.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/next.config.js b/next.config.js index 0515ac51670..93f9fa0b008 100644 --- a/next.config.js +++ b/next.config.js @@ -168,16 +168,13 @@ const nextConfig = { type: "asset/source", }); - config.externals ??= {}; - config.externals.push({ - knex: "commonjs knex", - }); - return config; }, - // Without this setting, Next.js has Webpack trying and failing to load + // Without adding MJML here, Next.js has Webpack trying and failing to load // uglify-js when compiling MJML email templates to HTML in `renderEmail.ts`: - serverExternalPackages: ["mjml"], + // commonjs and knex are needed to avoid errors about not being able to load + // better-sqlite3, for some reason. + serverExternalPackages: ["mjml", "commonjs", "knex"], }; const sentryOptions = {