You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+35
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,41 @@
37
37
38
38
Note that this behavior is TypeScript-specific. Babel doesn't support the `...` token at all (it gives the error "Spread children are not supported in React").
39
39
40
+
* Slightly adjust esbuild's handling of the `browser` field in `package.json` ([#2239](https://github.com/evanw/esbuild/issues/2239))
41
+
42
+
This release changes esbuild's interpretation of `browser` path remapping to fix a regression that was introduced in esbuild version 0.14.21. Browserify has a bug where it incorrectly matches package paths to relative paths in the `browser` field, and esbuild replicates this bug for compatibility with Browserify. I have a set of tests that I use to verify that esbuild's replication of this Browserify is accurate here: https://github.com/evanw/package-json-browser-tests. However, I was missing a test case and esbuild's behavior diverges from Browserify in this case. This release now handles this edge case as well:
43
+
44
+
* `entry.js`:
45
+
46
+
```js
47
+
require('pkg/sub')
48
+
```
49
+
50
+
* `node_modules/pkg/package.json`:
51
+
52
+
```json
53
+
{
54
+
"browser": {
55
+
"./sub": "./sub/foo.js",
56
+
"./sub/sub.js": "./sub/foo.js"
57
+
}
58
+
}
59
+
```
60
+
61
+
* `node_modules/pkg/sub/foo.js`:
62
+
63
+
```js
64
+
require('sub')
65
+
```
66
+
67
+
* `node_modules/sub/index.js`:
68
+
69
+
```js
70
+
console.log('works')
71
+
```
72
+
73
+
The import path `sub` in `require('sub')` was previously matching the remapping `"./sub/sub.js": "./sub/foo.js"` but with this release it should now no longer match that remapping. Now `require('sub')` will only match the remapping `"./sub/sub": "./sub/foo.js"` (without the trailing `.js`). Browserify apparently only matches without the `.js` suffix here.
74
+
40
75
## 0.14.38
41
76
42
77
* Further fixes to TypeScript 4.7 instantiation expression parsing ([#2201](https://github.com/evanw/esbuild/issues/2201))
0 commit comments