Skip to content

Commit b085827

Browse files
committed
missing importexports warning
1 parent 78f1d5f commit b085827

File tree

1 file changed

+21
-0
lines changed
  • configs/webpack-config-compass/src

1 file changed

+21
-0
lines changed

configs/webpack-config-compass/src/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ export function createElectronMainConfig(
147147
sharedObjectLoader(opts),
148148
sourceLoader(opts),
149149
],
150+
parser: {
151+
javascript: {
152+
// Webpack compile time check for imports matching exports is too strict
153+
// in cases where the code expects some name export to be optional
154+
// (webpack will break the build if it fails to statically see the
155+
// matching export) this is why we switch the check to just warn. If
156+
// this ever hides a real case where a missing import is being used, it
157+
// will definitely break in runtime anyway
158+
importExportsPresence: 'warn' as const,
159+
},
160+
},
150161
},
151162
node: false as const,
152163
externals: toCommonJsExternal(sharedExternals),
@@ -218,6 +229,11 @@ export function createElectronRendererConfig(
218229
sharedObjectLoader(opts),
219230
sourceLoader(opts),
220231
],
232+
parser: {
233+
javascript: {
234+
importExportsPresence: 'warn' as const,
235+
},
236+
},
221237
},
222238
plugins: [
223239
...entriesToHtml(entries),
@@ -338,6 +354,11 @@ export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
338354
assetsLoader(opts),
339355
sourceLoader(opts),
340356
],
357+
parser: {
358+
javascript: {
359+
importExportsPresence: 'warn' as const,
360+
},
361+
},
341362
},
342363
// This follows current Compass plugin behavior and is here more or less to
343364
// keep compat for the external plugin users

0 commit comments

Comments
 (0)