diff --git a/packages/webpack4-loader/src/index.ts b/packages/webpack4-loader/src/index.ts index cf11dd875..3a4848e26 100644 --- a/packages/webpack4-loader/src/index.ts +++ b/packages/webpack4-loader/src/index.ts @@ -80,6 +80,12 @@ export default function webpack4Loader( // This API is used by many loaders/plugins, so hope we're safe for a while const webpackResolveOptions = this._compilation?.options.resolve; + // Resolved configuration contains empty list of extensions as a default value + // https://github.com/callstack/linaria/issues/855 + if (webpackResolveOptions.extensions?.length === 0) { + delete webpackResolveOptions.extensions; + } + // Let's try to create a resolver with the webpack config let resolveSync = enhancedResolve.create.sync({ ...resolveOptionsDefaults, diff --git a/packages/webpack5-loader/src/index.ts b/packages/webpack5-loader/src/index.ts index a5484d65f..7d100aede 100644 --- a/packages/webpack5-loader/src/index.ts +++ b/packages/webpack5-loader/src/index.ts @@ -68,6 +68,12 @@ export default function webpack5Loader( // This API is used by many loaders/plugins, so hope we're safe for a while const webpackResolveOptions = this._compilation?.options.resolve; + // Resolved configuration contains empty list of extensions as a default value + // https://github.com/callstack/linaria/issues/855 + if (webpackResolveOptions.extensions?.length === 0) { + delete webpackResolveOptions.extensions; + } + // Let's try to create a resolver with the webpack config let resolveSync = enhancedResolve.create.sync({ ...resolveOptionsDefaults,