Financial-Times / x-dash

:x::heavy_minus_sign::newspaper: shared front-end components for FT.com and the FT Apps
https://financial-times.github.io/x-dash
38 stars 6 forks source link

fix: do not override current resolvers #763

Closed juanSanchezAlcala closed 6 months ago

juanSanchezAlcala commented 6 months ago

If we use x-engine inside a package in a monorepo usually the react / engine dependencies should be resolved to the parent node_modules . Currently x-engine set an alias resolving only from the the node_modules within the main package so in case you use it in a package inside a monorepo it wont work. With this fix we don't override a resolver alias already set and therefore we allow in a monorepo to set where we want to resolve these packages and make it work.

For example in a monorepo package that use webpack we could set something like this and make it work

resolve: {
    alias: {
      "react": '../../node_modules/react',
      "react-dom": '../../node_modules/react-dom',
    },
  },

Why this change ? Currently in cp-content-pipeline monorepo we use storybook inside the ui package and we need this change to make it work with x-engine