Skip to content

Commit

Permalink
fix(webpack):pass all user resolve options to loader(webpack 4, fixes c…
Browse files Browse the repository at this point in the history
  • Loading branch information
5angel committed Sep 2, 2021
1 parent 522356b commit 1cbc478
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions packages/webpack4-loader/src/index.ts
Expand Up @@ -44,11 +44,6 @@ export default function webpack4Loader(

EvalCache.clearForFile(this.resourcePath);

const resolveOptionsDefaults = {
conditionNames: ['require'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
};

const {
sourceMap = undefined,
cacheDirectory = '.linaria-cache',
Expand Down Expand Up @@ -80,12 +75,7 @@ export default function webpack4Loader(
// Another option is to read the webpack.config.js, but it won't work for programmatic usage
// This API is used by many loaders/plugins, so hope we're safe for a while
{
...resolveOptionsDefaults,
...((this._compilation?.options.resolve && {
alias: this._compilation.options.resolve.alias,
modules: this._compilation.options.resolve.modules,
}) ||
{}),
...(this._compilation?.options.resolve ?? {}),
...resolveOptions,
}
);
Expand Down

0 comments on commit 1cbc478

Please sign in to comment.