Skip to content

Commit

Permalink
Use conditional imports in package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Septh committed Aug 18, 2024
1 parent d768094 commit 2356b32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
"type": "module",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"imports": {
"#package.json": "./package.json"
},
"scripts": {
"build": "tsc -p tsconfig.build.json",
"build:dts": "tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --removeComments false",
Expand Down Expand Up @@ -85,7 +88,7 @@
"ts": "module"
},
"nodeArguments": [
"--import=@septh/ts-run/register"
"--import=@septh/ts-run"
]
}
}
2 changes: 1 addition & 1 deletion source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ interface PackageJson {
}

// Get our own name and version
const { name, version } = createRequire(import.meta.url)('../package.json') as PackageJson
const { name, version } = createRequire(import.meta.url)('#package.json') as PackageJson

// Files that mark the root of a monorepo
const workspaceRootFiles = new Set([
Expand Down

0 comments on commit 2356b32

Please sign in to comment.