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
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,50 @@
96
96
so providing inconsistent metadata for the same path can cause non-determinism.
97
97
```
98
98
99
+
* Suggest enabling a missing condition when `exports` map fails ([#2163](https://github.com/evanw/esbuild/issues/2163))
100
+
101
+
This release adds another suggestion to the error message that happens when an `exports` map lookup fails if the failure could potentially be fixed by adding a missing condition. Here's what the new error message looks like (which now suggests `--conditions=module` as a possible workaround):
102
+
103
+
```
104
+
✘ [ERROR] Could not resolve "@sentry/electron/main"
105
+
106
+
index.js:1:24:
107
+
1 │ import * as Sentry from '@sentry/electron/main'
108
+
╵ ~~~~~~~~~~~~~~~~~~~~~~~
109
+
110
+
The path "./main" is not currently exported by package "@sentry/electron":
111
+
112
+
node_modules/@sentry/electron/package.json:8:13:
113
+
8 │ "exports": {
114
+
╵ ^
115
+
116
+
None of the conditions provided ("require", "module") match any of the currently active conditions
117
+
("browser", "default", "import"):
118
+
119
+
node_modules/@sentry/electron/package.json:16:14:
120
+
16 │ "./main": {
121
+
╵ ^
122
+
123
+
Consider enabling the "module" condition if this package expects it to be enabled. You can use
124
+
"--conditions=module" to do that.
125
+
126
+
node_modules/@sentry/electron/package.json:18:6:
127
+
18 │ "module": "./esm/main/index.js"
128
+
╵ ~~~~~~~~
129
+
130
+
Consider using a "require()" call to import this file, which will work because the "require"
131
+
condition is supported by this package:
132
+
133
+
index.js:1:24:
134
+
1 │ import * as Sentry from '@sentry/electron/main'
135
+
╵ ~~~~~~~~~~~~~~~~~~~~~~~
136
+
137
+
You can mark the path "@sentry/electron/main" as external to exclude it from the bundle, which
138
+
will remove this error.
139
+
```
140
+
141
+
This particular package had an issue where it was using the Webpack-specific `module` condition without providing a `default` condition. It looks like the intent in this case was to use the standard `import` condition instead. This specific change wasn't suggested here because this error message is for package consumers, not package authors.
142
+
99
143
## 0.14.34
100
144
101
145
Something went wrong with the publishing script for the previous release. Publishing again.
expectedScanLog: `Users/user/project/src/entry.js: ERROR: Could not resolve "pkg1"
1980
1980
Users/user/project/node_modules/pkg1/package.json: NOTE: The path "." is not currently exported by package "pkg1":
1981
1981
Users/user/project/node_modules/pkg1/package.json: NOTE: None of the conditions provided ("what") match any of the currently active conditions ("browser", "default", "import"):
1982
+
Users/user/project/node_modules/pkg1/package.json: NOTE: Consider enabling the "what" condition if this package expects it to be enabled. You can use 'Conditions: []string{"what"}' to do that.
1982
1983
NOTE: You can mark the path "pkg1" as external to exclude it from the bundle, which will remove this error.
1983
1984
Users/user/project/src/entry.js: ERROR: Could not resolve "pkg1/foo.js"
1984
1985
Users/user/project/node_modules/pkg1/package.json: NOTE: The path "./foo.js" is not currently exported by package "pkg1":
1985
1986
Users/user/project/node_modules/pkg1/package.json: NOTE: None of the conditions provided ("what") match any of the currently active conditions ("browser", "default", "import"):
1987
+
Users/user/project/node_modules/pkg1/package.json: NOTE: Consider enabling the "what" condition if this package expects it to be enabled. You can use 'Conditions: []string{"what"}' to do that.
1986
1988
NOTE: You can mark the path "pkg1/foo.js" as external to exclude it from the bundle, which will remove this error.
expectedScanLog: `Users/user/project/src/entry.js: ERROR: Could not resolve "pkg1"
2020
2022
Users/user/project/node_modules/pkg1/package.json: NOTE: The path "." is not currently exported by package "pkg1":
2021
2023
Users/user/project/node_modules/pkg1/package.json: NOTE: None of the conditions provided ("require") match any of the currently active conditions ("browser", "default", "import"):
2022
-
Users/user/project/src/entry.js: NOTE: Consider using a "require()" call to import this file:
2024
+
Users/user/project/src/entry.js: NOTE: Consider using a "require()" call to import this file, which will work because the "require" condition is supported by this package:
2023
2025
NOTE: You can mark the path "pkg1" as external to exclude it from the bundle, which will remove this error.
2024
2026
Users/user/project/src/entry.js: ERROR: Could not resolve "pkg1/foo.js"
2025
2027
Users/user/project/node_modules/pkg1/package.json: NOTE: The path "./foo.js" is not currently exported by package "pkg1":
2026
2028
Users/user/project/node_modules/pkg1/package.json: NOTE: None of the conditions provided ("require") match any of the currently active conditions ("browser", "default", "import"):
2027
-
Users/user/project/src/entry.js: NOTE: Consider using a "require()" call to import this file:
2029
+
Users/user/project/src/entry.js: NOTE: Consider using a "require()" call to import this file, which will work because the "require" condition is supported by this package:
2028
2030
NOTE: You can mark the path "pkg1/foo.js" as external to exclude it from the bundle, which will remove this error.
expectedScanLog: `Users/user/project/src/entry.js: ERROR: Could not resolve "pkg1"
2062
2064
Users/user/project/node_modules/pkg1/package.json: NOTE: The path "." is not currently exported by package "pkg1":
2063
2065
Users/user/project/node_modules/pkg1/package.json: NOTE: None of the conditions provided ("import") match any of the currently active conditions ("browser", "default", "require"):
2064
-
Users/user/project/src/entry.js: NOTE: Consider using an "import" statement to import this file:
2066
+
Users/user/project/src/entry.js: NOTE: Consider using an "import" statement to import this file, which will work because the "import" condition is supported by this package:
2065
2067
NOTE: You can mark the path "pkg1" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
2066
2068
Users/user/project/src/entry.js: ERROR: Could not resolve "pkg1/foo.js"
2067
2069
Users/user/project/node_modules/pkg1/package.json: NOTE: The path "./foo.js" is not currently exported by package "pkg1":
2068
2070
Users/user/project/node_modules/pkg1/package.json: NOTE: None of the conditions provided ("import") match any of the currently active conditions ("browser", "default", "require"):
2069
-
Users/user/project/src/entry.js: NOTE: Consider using an "import" statement to import this file:
2071
+
Users/user/project/src/entry.js: NOTE: Consider using an "import" statement to import this file, which will work because the "import" condition is supported by this package:
2070
2072
NOTE: You can mark the path "pkg1/foo.js" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
0 commit comments