Skip to content

feat(shared, frontend, backend): organise shared exports dual format build#9215

Open
kevin9foong wants to merge 6 commits intodevelopfrom
feat/organise-shared-exports-dual-format-build
Open

feat(shared, frontend, backend): organise shared exports dual format build#9215
kevin9foong wants to merge 6 commits intodevelopfrom
feat/organise-shared-exports-dual-format-build

Conversation

@kevin9foong
Copy link
Copy Markdown
Contributor

@kevin9foong kevin9foong commented Mar 18, 2026

Problem

Enable dual-format building for shared package.

Requirements:

  • esm support for react, newer node modules
  • cjs support for older node modules
  • dual format build tool which can help automate a bunch of items (eg, creating the exports mapping to cjs, esm)
  • build tool should able to be used for sdk also (to provide standardization)

Closes [insert issue #]

Solution

Suggesting the following structure:

  • modules: each module eg, logic has its own barrel
  • utils: omit the barrel file, since each util is independent and not really related to each other, hence should have its own export
  • types: support for barrel import and deep imports
  • constants: support for barrel import and deep imports

To support the barrel for constants, we need to fix the name conflict with types in constants/fields/myinfo and constants/fields/basic, hence they have been renamed to avoid conflict.

Use tsdown to automate esm, cjs build and export resolution.

ci.yml dependency updates should theoretically speed up our ci.yml job completion by 1-2mins per run.

Breaking Changes

No - this PR is backwards compatible

@kevin9foong kevin9foong force-pushed the feat/organise-shared-exports-dual-format-build branch from 25e77ab to 43bc9c6 Compare March 18, 2026 03:58
@kevin9foong kevin9foong force-pushed the feat/organise-shared-exports-dual-format-build branch from 43bc9c6 to feccf69 Compare March 18, 2026 04:04
@datadog-opengovsg
Copy link
Copy Markdown

datadog-opengovsg Bot commented Mar 18, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: c3c1620 | Docs | Was this helpful? Give us feedback!

@kevin9foong kevin9foong self-assigned this Mar 18, 2026
@kevin9foong kevin9foong force-pushed the feat/organise-shared-exports-dual-format-build branch 6 times, most recently from 137bbaf to 1fd6ab9 Compare March 18, 2026 06:14
Comment thread .github/workflows/ci.yml
- run: pnpm lint:frontend

backend_test:
needs: [changes, install, build]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rationale: backend test does not need to wait for build, saving ~2mins in ci time

@kevin9foong kevin9foong force-pushed the feat/organise-shared-exports-dual-format-build branch 7 times, most recently from 21780de to 623ed56 Compare March 18, 2026 07:15
@kevin9foong kevin9foong force-pushed the feat/organise-shared-exports-dual-format-build branch from 623ed56 to c3c1620 Compare March 18, 2026 07:18
Comment thread .github/workflows/ci.yml
env:
NODE_OPTIONS: '--max-old-space-size=4096'
AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: 1
- name: Upload build files
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: these build files are not being used

@kevin9foong kevin9foong changed the title feat: organise shared exports dual format build feat(shared, frontend, backend): organise shared exports dual format build Mar 18, 2026
@kevin9foong kevin9foong marked this pull request as ready for review March 18, 2026 07:35
@kevin9foong kevin9foong requested a review from a team as a code owner March 18, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant