You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Build system inconsistencies create more complexity than necessary
403
407
- Package boundaries need clearer definition between domain and persistence concerns
404
408
409
+
### ESM Import Path Resolution Issues
410
+
411
+
#### Problem Discovered:
412
+
When building dual CommonJS/ESM packages, simply renaming `.js` files to `.mjs` isn't sufficient - the import statements inside the files must also be updated to reference `.mjs` extensions.
413
+
414
+
#### Specific Issue:
415
+
- Common package generated both `elo.js` (CJS) and `elo.mjs` (ESM)
416
+
- ESM `index.mjs` still contained `export * from './elo.js'`
417
+
- Express app (running in ESM mode) tried to import ESM version but got wrong file references
418
+
- Runtime error: `The requested module '@vue-skuilder/common' does not provide an export named 'EloToNumber'`
419
+
420
+
#### Root Cause:
421
+
ESM requires explicit file extensions and the build process wasn't updating import paths within files when creating the `.mjs` versions.
422
+
423
+
#### Solution Implemented:
424
+
Updated build script to use `sed` to replace `.js` with `.mjs` in import statements:
This type of import path issue would affect any ESM consumer of workspace packages and demonstrates the complexity of maintaining dual module formats manually.
431
+
405
432
## Current Status (Session 1 Complete)
406
433
407
434
### ✅ Completed Today
408
435
- Created shared `tsconfig.base.json` with ES2022 target and strict settings
409
-
- Migrated `common`and `db` packages to extend base configuration
410
-
- Fixed unused parameter strictness issue in common package
436
+
- Migrated `common`, `db`, and `express` packages to extend base configuration
437
+
- Fixed unused parameter strictness issues across packages
411
438
- Added dual CommonJS/ESM exports to shared libraries
412
439
- Resolved database type export issues and naming conflicts
413
-
- Verified all builds and dev environment still work
440
+
- Fixed ESM import path issues (.js → .mjs) in build process
441
+
- Verified all builds, dev environment, and express runtime working
414
442
415
443
### 🎯 Next Session Goals
416
-
- Update express package to use base config
417
444
- Fix e2e-db Jest import issues with new CommonJS exports
418
445
- Complete backend TypeScript standardization
419
446
- Test full integration with Jest consuming CommonJS exports
447
+
- Verify IDE intellisense works across all backend packages
0 commit comments