Skip to content

Commit

Permalink
Replace webpack.config.externals
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
Vinnl committed Jan 9, 2025
1 parent 00e6c6f commit e5a5947
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit e5a5947

Please sign in to comment.