When configuring module builds, maintain consistent and explicit configuration for different module formats (CJS, ESM, modern) to ensure compatibility across environments. Package exports should be clearly defined with appropriate conditions for each module system.
When configuring module builds, maintain consistent and explicit configuration for different module formats (CJS, ESM, modern) to ensure compatibility across environments. Package exports should be clearly defined with appropriate conditions for each module system.
Best practices:
const packageExports = {
'.': {
types: './index.d.ts',
import: './index.mjs', // ESM with .mjs extension
'mui-modern': './index.modern.mjs', // Modern build with condition
require: './index.js', // CJS with .js extension
},
// Other exports...
};
Ensure all necessary metadata (like sideEffects) is included in all package.json configurations
Enter the URL of a public GitHub repository