Skip to content

Commit 982bdb1

Browse files
committed
chore: release v3.0.3
Fix critical ESM/CJS interop by disabling minification - Disable minification in esbuild config (libraries should not be minified) - Remove fix-commonjs-exports build step (no longer needed) - Unminified esbuild output has clear __export patterns Node.js ESM understands - Verified with real .mjs module imports from CJS dist
1 parent 226f181 commit 982bdb1

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

.config/esbuild.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export const buildConfig = {
6767
platform: 'node',
6868
target: 'node18',
6969
sourcemap: true,
70-
// Minify for production builds (can be overridden in watch mode)
71-
minify: true,
70+
// Don't minify - this is a library and minification breaks ESM/CJS interop
71+
minify: false,
7272
// Tree-shaking optimization
7373
treeShaking: true,
7474
metafile: true,

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.0.3](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.3) - 2025-11-01
9+
10+
### Fixed
11+
12+
- **Critical: Node.js ESM/CJS interop completely fixed**: Disabled minification to ensure proper ESM named import detection
13+
- Root cause: esbuild minification was breaking Node.js ESM's CJS named export detection
14+
- Solution: Disabled minification entirely (`minify: false` in esbuild config)
15+
- Libraries should not be minified - consumers minify during their own build process
16+
- Unminified esbuild output uses clear `__export` patterns that Node.js ESM natively understands
17+
- Removed `fix-commonjs-exports.mjs` build script - no longer needed with unminified code
18+
- ESM imports now work reliably: `import { getDefaultLogger } from '@socketsecurity/lib/logger'`
19+
- Verified with real-world ESM module testing (`.mjs` files importing from CJS `.js` dist)
20+
821
## [3.0.2](https://github.com/SocketDev/socket-lib/releases/tag/v3.0.2) - 2025-11-01
922

1023
### Fixed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@socketsecurity/lib",
3-
"version": "3.0.2",
3+
"version": "3.0.3",
44
"license": "MIT",
55
"description": "Core utilities and infrastructure for Socket.dev security tools",
66
"keywords": [

scripts/fix-build.mjs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @fileoverview Orchestrates all post-build fix scripts.
3-
* Runs generate-package-exports, fix-commonjs-exports, and fix-external-imports in sequence.
3+
* Runs generate-package-exports and fix-external-imports in sequence.
44
*/
55

66
import { isQuiet } from './utils/flags.mjs'
@@ -28,10 +28,7 @@ async function main() {
2828
args: ['scripts/generate-package-exports.mjs', ...fixArgs],
2929
command: 'node',
3030
},
31-
{
32-
args: ['scripts/fix-commonjs-exports.mjs', ...fixArgs],
33-
command: 'node',
34-
},
31+
// fix-commonjs-exports no longer needed - unminified esbuild output is ESM-compatible
3532
{
3633
args: ['scripts/fix-external-imports.mjs', ...fixArgs],
3734
command: 'node',

0 commit comments

Comments
 (0)