Nx: Custom Webpack Configuration - Url Loader

Created on 27 Nov 2019  路  1Comment  路  Source: nrwl/nx

Hi, I tried to include custom loaders in my Nx React Monorepo. It is pretty simple. I want to load SVG and other assets as modules. However, something is wrong in my setup.

The only two things that I did are:
Made custom webpack config
Linked to that config in workspace.json

Please see the pictures below...

image

image

Thank you for your help.

Most helpful comment

@vladamx
I had a similar problem and solved it by adding @nrwl/react/plugins/babel.
https://github.com/nrwl/nx/issues/1931#issuecomment-542499887

const babelWebpackConfig = require('@nrwl/react/plugins/babel');

module.exports = config => {
  config.module.rules.unshift(...);
  return babelWebpackConfig(config);
};

>All comments

@vladamx
I had a similar problem and solved it by adding @nrwl/react/plugins/babel.
https://github.com/nrwl/nx/issues/1931#issuecomment-542499887

const babelWebpackConfig = require('@nrwl/react/plugins/babel');

module.exports = config => {
  config.module.rules.unshift(...);
  return babelWebpackConfig(config);
};
Was this page helpful?
0 / 5 - 0 ratings