Skip to content

Commit

Permalink
Export Frontend: first steps
Browse files Browse the repository at this point in the history
Note: needs deletion of app/api/trpc-node/[trpc]/route.ts due to
an upstream issue
  • Loading branch information
enricoros committed Feb 18, 2024
1 parent 8299b4c commit c7fe758
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
const BuildOptions = {
// Future: Electron/Frontend-only builds
exportFrontend: false,
};

/** @type {import('next').NextConfig} */
let nextConfig = {
reactStrictMode: true,

// Note: disabled to chech whether the project becomes slower with this
// modularizeImports: {
// '@mui/icons-material': {
// transform: '@mui/icons-material/{{member}}',
// },
// },
// [exporting] https://nextjs.org/docs/advanced-features/static-html-export
...BuildOptions.exportFrontend && {
// Export the frontend to ./dist
output: 'export',
distDir: 'dist',

// Disable Image optimization
images: { unoptimized: true },

// Optional: Change links `/me` -> `/me/` and emit `/me.html` -> `/me/index.html`
// trailingSlash: true,
},

// [puppeteer] https://github.com/puppeteer/puppeteer/issues/11052
experimental: {
Expand All @@ -24,9 +35,20 @@ let nextConfig = {
layers: true,
};

// [exporting] prevent too many small files (50kb)
if (BuildOptions.exportFrontend)
config.optimization.splitChunks.minSize = 50 * 1024;

return config;
},

// Note: disabled to check whether the project becomes slower with this
// modularizeImports: {
// '@mui/icons-material': {
// transform: '@mui/icons-material/{{member}}',
// },
// },

// Uncomment the following leave console messages in production
// compiler: {
// removeConsole: false,
Expand Down

0 comments on commit c7fe758

Please sign in to comment.