Skip to content

Commit

Permalink
fix(core): resolve webpack loaders with require.resolve() (#3341)
Browse files Browse the repository at this point in the history
With strict package managers such as pnpm or Yarn PnP, transitive
dependencies are *not* hoisted to the root node_modules folder. This
means that a webpack config defined within a package like
'@nrwl/cypress' cannot resolve loaders like 'ts-loader', unless
'ts-loader' is declared in the workspace's own package.json.

This is a problem because the workspace might define a different version
of 'ts-loader', incompatible with the version declared by
'@nrwl/cypress/package.json'. The workspace should not need to declare
a dependency on 'ts-loader' anyway.

See also:
* pnpm/pnpm#801
* webpack/webpack#5087
  • Loading branch information
elliottsj authored Jul 15, 2020
1 parent 084779b commit 0bbfc49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function createWebpackConfig(
use: [
'@svgr/webpack?-svgo,+titleProp,+ref![path]',
{
loader: 'url-loader',
loader: require.resolve('url-loader'),
options: {
limit: 10000, // 10kB
name: '[name].[hash:7].[ext]',
Expand All @@ -70,7 +70,7 @@ export function createWebpackConfig(
{
use: [
{
loader: 'url-loader',
loader: require.resolve('url-loader'),
options: {
limit: 10000, // 10kB
name: '[name].[hash:7].[ext]',
Expand Down

0 comments on commit 0bbfc49

Please sign in to comment.