react-ui icon indicating copy to clipboard operation
react-ui copied to clipboard

No changes when using `npm link`

Open mbohal opened this issue 6 months ago • 4 comments

Steps:

  1. Clone RUI and consumer application (APP)
  2. Make APP use dist version of RUI (the import { Button } from '@react-ui-org/react-ui'; syntax )
  3. Use npm-link in APP to force it to use RUI source (see: https://react-ui.io/docs/contribute/general-guidelines/#package-linking)
  4. Start RUI dev server npm start / docker compose up node_dev_server
  5. Make changes in RUI

Expected behaviour: RUI changes are reflected in APP Current behaviour: RUi changes are not reflected in APP

Cause

In RUI the npm start (=webpack --watch) script builds to the folder src/docs/_assets/generated/, but APP expects the output to be in dist. The sources are only copied to the dist folder in npm posbuild script.

Solution

As we can not drop outputting the build source to src/docs/_assets/generated/ as it is needed for mkdocs docs, so we need to do one of the following:

  • use symlink
  • output from webpack to two locations

The decision is up to the author and it should be documented in an ADR (use same structure as in RA2W).

Documentation might need to be updated accordingly.

mbohal avatar Jun 02 '25 07:06 mbohal

npm start in RUI will output react-ui.development.js, but in the package.json the entrypoint is defined as dist/react-ui.js. This means that no change will be reflected. I can't think of another solution other than making both the dev and prod build be react-ui.js, or some webpack config hacks.

atmelmicro avatar Jul 10 '25 10:07 atmelmicro

or some webpack config hacks

Do you have something specific in mind?

mbohal avatar Jul 10 '25 12:07 mbohal

Could not come up with anything, even if the files for dev and prod would be the same, I still couldn't make webpack reload on react-ui change. I don't feel like there is a clean way to solve this

atmelmicro avatar Aug 11 '25 09:08 atmelmicro

@atmelmicro

I don't feel like there is a clean way to solve this

Do you have any not so clean way in mind?

mbohal avatar Aug 26 '25 13:08 mbohal