design-system-react icon indicating copy to clipboard operation
design-system-react copied to clipboard

How to Setup in CRA 4.x the documentation has no steps for setting up while using the latest CRA version.

Open pardhav opened this issue 4 years ago • 4 comments

pardhav avatar May 02 '21 12:05 pardhav

Thanks for opening your first issue! :wave: If you have found this library helpful, please star it. A maintainer will try to respond within 7 days. If you haven’t heard anything by then, please bump this thread.

welcome[bot] avatar May 02 '21 12:05 welcome[bot]

Any update on this?

no-stack-dub-sack avatar Dec 14 '21 21:12 no-stack-dub-sack

@pardhav and anyone else who may be struggling with this, the following worked for me using the latest version of CRA:

  1. Follow all the steps in the CRA 2.x guide, but also install react-app-rewire-babel-loader to your dev dependencies
  2. Replace the contents of config-overrides.js with the following:
const path = require("path");
const fs = require("fs");
const rewireBabelLoader = require("react-app-rewire-babel-loader");

const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);

module.exports = function override(config, env) {
  config = rewireBabelLoader.include(
    config,
    resolveApp("node_modules/@salesforce/design-system-react"),
  );

  return config;
};

no-stack-dub-sack avatar Dec 15 '21 02:12 no-stack-dub-sack

This issue has been automatically marked as stale, because it has not had recent activity. It will be closed if no further activity occurs. Maintainers are responsible for tech debt and project health. This is most likely a new components or component feature request. Please submit a pull request for or request feedback on this feature. Thank you.

stale[bot] avatar Apr 18 '22 19:04 stale[bot]