Open
Description
Problem
I tried minification in my open-next.config.ts which seems to be "experimental" according to the documentation:
import type { OpenNextConfig } from 'open-next/types/open-next.d.ts'
const config = {
default: { // This is the default server, similar to the server-function in open-next v2
minify: true, // This will minify the output
},
} satisfies OpenNextConfig
export default config;
export type Config = typeof config
I deployed my app and started testing. At first glance everything seemed to work. Some pages (not all) threw internal server errors.
I inspected the server function lambda logs which included this error for the invocations that seemed to result in the error pages:
2024-09-11T12:41:17.211Z 3dec7f91-6ae3-4b73-8d65-f08442892fd3 ERROR ⨯ file:///var/task/node_modules/@emotion/react/dist/emotion-react.cjs.mjs:13
withEmotionCache,
^^^^^^^^^^^^^^^^
SyntaxError: Named export 'withEmotionCache' not found. The requested module './emotion-react.cjs.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from './emotion-react.cjs.js';
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:191:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:432:15)
Notable dependency versions:
- NextJS: 14.2.3 (pages router)
- MUI: ^5
- emotion: ^11
- open-next: 3.1.2
Workaround
I disabled the minify
option and redeployed the app. The pages that were previously broken work with no issues.
Metadata
Metadata
Assignees
Labels
No labels