Skip to content

Commit 5df5daa

Browse files
authored
Add missing main field for @tailwindcss/browser (#15594)
This PR adds a `main` and `browser` field for the `@tailwindcss/browser` package. In the package, we do have the `exports` field setup, which is an alternative to the `main` field according to the docs: > The "exports" provides a modern alternative to "main" … > > — https://docs.npmjs.com/cli/v10/configuring-npm/package-json?v=true#exports However, if you look at the unpkg link: https://unpkg.com/@tailwindcss/browser, it tries to load the `index.js` file. This is probably a bug in the unpkg resolver. That said, if you look at other CDNs such as esm.sh, it does resolve correctly: https://esm.sh/@tailwindcss/browser According to the npm docs: > If `main` is not set, it defaults to `index.js` in the package's root folder. > > — https://docs.npmjs.com/cli/v10/configuring-npm/package-json?v=true#main This explains why unpkg is trying to load the `index.js` file. Additionally, the npm docs also mention the `browser` field: > If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren't available in Node.js modules. (e.g. window) > > — https://docs.npmjs.com/cli/v10/configuring-npm/package-json?v=true#browser So this PR also adds that field just to be sure.
1 parent 0ed4d81 commit 5df5daa

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Add missing `main` and `browser` fields for `@tailwindcss/browser` ([#15594](https://github.com/tailwindlabs/tailwindcss/pull/15594))
1113

1214
## [4.0.0-beta.9] - 2025-01-09
1315

packages/@tailwindcss-browser/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
"version": "4.0.0-beta.9",
44
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
55
"license": "MIT",
6+
"main": "./dist/index.mjs",
7+
"browser": "./dist/index.mjs",
68
"repository": {
79
"type": "git",
810
"url": "https://github.com/tailwindlabs/tailwindcss.git",

0 commit comments

Comments
 (0)