Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this works? #186

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tasty-lies-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@t3-oss/env-nextjs": patch
"@t3-oss/env-core": patch
"@t3-oss/env-nuxt": patch
---

fix exports condition once more...
26 changes: 6 additions & 20 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,26 @@
"name": "@t3-oss/env-core",
"version": "0.9.1",
"type": "module",
"keywords": [
"create-t3-app",
"environment variables",
"zod"
],
"keywords": ["create-t3-app", "environment variables", "zod"],
"author": "Julius Marminge",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/t3-oss/t3-env",
"directory": "packages/core"
},
"main": "dist/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./presets": {
"import": {
"types": "./dist/presets.d.ts",
"default": "./dist/presets.js"
}
"types": "./dist/presets.d.ts",
"default": "./dist/presets.js"
}
},
"files": [
"dist",
"package.json",
"LICENSE",
"README.md"
],
"files": ["dist", "package.json", "LICENSE", "README.md"],
"scripts": {
"build": "rm -rf dist && bunchee",
"dev": "bunhcee -w",
Expand Down
27 changes: 6 additions & 21 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,26 @@
"name": "@t3-oss/env-nextjs",
"version": "0.9.1",
"type": "module",
"keywords": [
"create-t3-app",
"environment variables",
"zod",
"nextjs"
],
"keywords": ["create-t3-app", "environment variables", "zod", "nextjs"],
"author": "Julius Marminge",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/t3-oss/t3-env",
"directory": "packages/nextjs"
},
"main": "dist/index.js",
Copy link

Choose a reason for hiding this comment

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

I believe this line is breaking the import. Typescript just can't find it anymore. It works on 0.9.1

Copy link

Choose a reason for hiding this comment

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

Any chance this was an wrong change, @juliusmarminge ?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's only breaking if your tsconfig cant read exports field

Choose a reason for hiding this comment

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

same to me:

My tsconfig:

{
  "compilerOptions": {
    "tsBuildInfoFile": "node_modules/.cache/typescript/tsbuildinfo.json",
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "target": "ES2022",
    "esModuleInterop": true,
    "module": "ESNext",
    "moduleResolution": "Node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "lib": ["ESNext", "DOM", "DOM.Iterable"],
    "noUncheckedIndexedAccess": true,
      "incremental": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"]
    },
    "plugins": [
      {
        "name": "next"
      }
    ],
  },
  "include": [
    "next-env.d.ts",
    "next-auth.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts"
  ],
  "exclude": ["node_modules"]
}

Copy link

Choose a reason for hiding this comment

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

I'm not seeing typings being locatable or available in 0.10.1 when installed. Additionally, npmjs.org doesn't report them as being available, either. See the screenshot of released versions:

npmjs-typescript

Copy link
Member Author

Choose a reason for hiding this comment

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

You'll get types through exports condition if you have a modern moduleResolution

Copy link

Choose a reason for hiding this comment

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

@juliusmarminge : Ahh ... you're correct. Using something like moduleResolution: "bundler" correctly identifies the types. Thank you!

"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./presets": {
"import": {
"types": "./dist/presets.d.ts",
"default": "./dist/presets.js"
}
"types": "./dist/presets.d.ts",
"default": "./dist/presets.js"
}
},
"files": [
"dist",
"package.json",
"LICENSE",
"README.md"
],
"files": ["dist", "package.json", "LICENSE", "README.md"],
"scripts": {
"build": "rm -rf dist && bunchee",
"dev": "bunchee -w",
Expand Down
28 changes: 6 additions & 22 deletions packages/nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,26 @@
"name": "@t3-oss/env-nuxt",
"version": "0.9.1",
"type": "module",
"keywords": [
"create-t3-app",
"environment variables",
"zod",
"nuxt",
"vue"
],
"keywords": ["create-t3-app", "environment variables", "zod", "nuxt", "vue"],
"author": "Julius Marminge",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/t3-oss/t3-env",
"directory": "packages/nuxt"
},
"main": "dist/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./presets": {
"import": {
"types": "./dist/presets.d.ts",
"default": "./dist/presets.js"
}
"types": "./dist/presets.d.ts",
"default": "./dist/presets.js"
}
},
"files": [
"dist",
"package.json",
"LICENSE",
"README.md"
],
"files": ["dist", "package.json", "LICENSE", "README.md"],
"scripts": {
"build": "rm -rf dist && bunchee",
"dev": "bunchee -w",
Expand Down