javascripter / postcss-react-strict-dom

A PostCSS plugin to integrate React Strict DOM with static CSS extraction, compatible with Next.js, Expo, and other bundlers
1 stars 0 forks source link

Include RSD package path in include option by default #1

Closed javascripter closed 12 hours ago

javascripter commented 12 hours ago

Why

ref. https://github.com/facebook/react-strict-dom/issues/236#issuecomment-2475731831

At the moment, users manually have to add react-strict-dom source files in their config.

include: [
  'node_modules/react-strict-dom/dist/**/*.{js,jsx,ts,tsx}',
]

This is cumbersome and can be especially error-prone in a monorepo because packages may get hoisted to a root depending on how project is configured.

This PR pre-configures include option by adding the appropriate glob paths by default so that users do not need to add it to their config.

How

By using require.resolve('react-strict-dom/package.json') to determine the installed path of react-strict-dom.

Users will still need to provide their application source code paths in their include option, so the default include and exclude paths are now always added to the config.

Test Plan