Skip to content

feat: node.js subpath imports - #76

Merged
dotnize merged 12 commits into
mainfrom
node-subpath-imports
Aug 13, 2026
Merged

dotnize merged 12 commits into
mainfrom
node-subpath-imports

Conversation

@dotnize

@dotnize dotnize commented May 5, 2026

Copy link
Copy Markdown
Member

Following #77, since we already use #/* for the tsconfig path alias.

Switch from TypeScript path aliases to standard built-in Node.js subpath imports, which are now supported by the shadcn CLI.

This uses the recommended explicit subpath mapping:

// package.json
{
  "imports": {
    "#/*": "./src/*"
  }
}

Because Node.js subpath imports do not perform extension or directory-index resolution, internal #/ imports now include their TypeScript file extensions and explicitly reference index.ts files where applicable:

import { env } from "#/env/server.ts"; // src/env/server.ts
import * as schema from "#/lib/db/schema/index.ts"; // src/lib/db/schema/index.ts
import { Button } from "#/components/ui/button.tsx"; // src/components/ui/button.tsx

TypeScript is configured with allowImportingTsExtensions;

// tsconfig.json
{
  "compilerOptions": {
    "allowImportingTsExtensions": true,
  }
}

This keeps a single catch-all alias while following the explicit Node.js subpath-imports model. It avoids relying on array targets to emulate extension guessing: every import maps directly to the file identified by its specifier.

References

@netlify

netlify Bot commented May 5, 2026

Copy link
Copy Markdown

Deploy Preview for mugnavo-tanstarter ready!

Name Link
🔨 Latest commit a05ae2b
🔍 Latest deploy log https://app.netlify.com/projects/mugnavo-tanstarter/deploys/6a7df15e714e400008f93258
😎 Deploy Preview https://deploy-preview-76--mugnavo-tanstarter.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

This comment was marked as outdated.

@dotnize
dotnize merged commit 0852761 into main Aug 13, 2026
4 checks passed
@dotnize
dotnize deleted the node-subpath-imports branch August 13, 2026 16:32
dotnize added a commit to mugnavo/cove-monorepo that referenced this pull request Aug 13, 2026
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.

2 participants