webpack 5.5.1 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

@@ -109,52 +109,18 @@ class HarmonyImportDependency extends ModuleDependency {
109
109
  moduleGraph,
110
110
  parentModule.buildMeta.strictHarmonyModule
111
111
  );
112
- switch (exportsType) {
113
- case "default-only":
114
- // It's has only a default export
115
- if (ids.length > 0 && ids[0] !== "default") {
116
- // In strict harmony modules we only support the default export
117
- return [
118
- new HarmonyLinkingError(
119
- `Can't import the named export ${ids
120
- .map(id => `'${id}'`)
121
- .join(
122
- "."
123
- )} ${additionalMessage} from default-exporting module (only default export is available)`
124
- )
125
- ];
126
- }
127
- return;
128
- case "default-with-named":
129
- // It has a default export and named properties redirect
130
- // In some cases we still want to warn here
131
- if (
132
- ids.length > 0 &&
133
- ids[0] !== "default" &&
134
- importedModule.buildMeta.defaultObject === "redirect-warn"
135
- ) {
136
- // For these modules only the default export is supported
137
- return [
138
- new HarmonyLinkingError(
139
- `Should not import the named export ${ids
140
- .map(id => `'${id}'`)
141
- .join(
142
- "."
143
- )} ${additionalMessage} from default-exporting module (only default export is available soon)`
144
- )
145
- ];
146
- }
112
+ if (exportsType === "namespace" || exportsType === "default-with-named") {
113
+ if (ids.length === 0) {
147
114
  return;
148
- case "namespace": {
149
- if (ids.length === 0) {
150
- return;
151
- }
115
+ }
152
116
 
153
- if (moduleGraph.isExportProvided(importedModule, ids) !== false) {
154
- // It's provided or we are not sure
155
- return;
156
- }
117
+ if (
118
+ (exportsType !== "default-with-named" || ids[0] !== "default") &&
119
+ moduleGraph.isExportProvided(importedModule, ids) === false
120
+ ) {
121
+ // We are sure that it's not provided
157
122
 
123
+ // Try to provide detailed info in the error message
158
124
  let pos = 0;
159
125
  let exportsInfo = moduleGraph.getExportsInfo(importedModule);
160
126
  while (pos < ids.length && exportsInfo) {
@@ -180,7 +146,7 @@ class HarmonyImportDependency extends ModuleDependency {
180
146
  exportsInfo = exportInfo.getNestedExportsInfo();
181
147
  }
182
148
 
183
- // We are sure that it's not provided
149
+ // General error message
184
150
  return [
185
151
  new HarmonyLinkingError(
186
152
  `export ${ids
@@ -192,6 +158,43 @@ class HarmonyImportDependency extends ModuleDependency {
192
158
  ];
193
159
  }
194
160
  }
161
+ switch (exportsType) {
162
+ case "default-only":
163
+ // It's has only a default export
164
+ if (ids.length > 0 && ids[0] !== "default") {
165
+ // In strict harmony modules we only support the default export
166
+ return [
167
+ new HarmonyLinkingError(
168
+ `Can't import the named export ${ids
169
+ .map(id => `'${id}'`)
170
+ .join(
171
+ "."
172
+ )} ${additionalMessage} from default-exporting module (only default export is available)`
173
+ )
174
+ ];
175
+ }
176
+ break;
177
+ case "default-with-named":
178
+ // It has a default export and named properties redirect
179
+ // In some cases we still want to warn here
180
+ if (
181
+ ids.length > 0 &&
182
+ ids[0] !== "default" &&
183
+ importedModule.buildMeta.defaultObject === "redirect-warn"
184
+ ) {
185
+ // For these modules only the default export is supported
186
+ return [
187
+ new HarmonyLinkingError(
188
+ `Should not import the named export ${ids
189
+ .map(id => `'${id}'`)
190
+ .join(
191
+ "."
192
+ )} ${additionalMessage} from default-exporting module (only default export is available soon)`
193
+ )
194
+ ];
195
+ }
196
+ break;
197
+ }
195
198
  }
196
199
 
197
200
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "author": "Tobias Koppers @sokra",
5
5
  "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
6
6
  "license": "MIT",