@@ -111,6 +111,14 @@ const sharedResolveOptions = (
111111 // Some lg test helpers that are getting bundled due to re-exporting from
112112 // the actual component packages, never needed in the webpack bundles
113113 '@lg-tools/test-harnesses' : false ,
114+
115+ // The react/jsx-runtime can fail the import when imported from an esm
116+ // module because React 17 doesn't have ./jsx-runtime specified in the
117+ // package.json `exports` field. This issue will go away if we can update
118+ // to React 18, but for the time being we will just resolve react to
119+ // actual files ourselves to work around that
120+ 'react/jsx-runtime' : require . resolve ( 'react/jsx-runtime' ) ,
121+ react : require . resolve ( 'react' ) ,
114122 } ,
115123 } ;
116124} ;
@@ -147,6 +155,17 @@ export function createElectronMainConfig(
147155 sharedObjectLoader ( opts ) ,
148156 sourceLoader ( opts ) ,
149157 ] ,
158+ parser : {
159+ javascript : {
160+ // Webpack compile time check for imports matching exports is too strict
161+ // in cases where the code expects some name export to be optional
162+ // (webpack will break the build if it fails to statically see the
163+ // matching export) this is why we switch the check to just warn. If
164+ // this ever hides a real case where a missing import is being used, it
165+ // will definitely break in runtime anyway
166+ importExportsPresence : 'warn' as const ,
167+ } ,
168+ } ,
150169 } ,
151170 node : false as const ,
152171 externals : toCommonJsExternal ( sharedExternals ) ,
@@ -218,6 +237,11 @@ export function createElectronRendererConfig(
218237 sharedObjectLoader ( opts ) ,
219238 sourceLoader ( opts ) ,
220239 ] ,
240+ parser : {
241+ javascript : {
242+ importExportsPresence : 'warn' as const ,
243+ } ,
244+ } ,
221245 } ,
222246 plugins : [
223247 ...entriesToHtml ( entries ) ,
@@ -338,6 +362,11 @@ export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
338362 assetsLoader ( opts ) ,
339363 sourceLoader ( opts ) ,
340364 ] ,
365+ parser : {
366+ javascript : {
367+ importExportsPresence : 'warn' as const ,
368+ } ,
369+ } ,
341370 } ,
342371 // This follows current Compass plugin behavior and is here more or less to
343372 // keep compat for the external plugin users
0 commit comments