-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: tailwind configuration works in mono repos #2847
base: next
Are you sure you want to change the base?
Conversation
// note: this will return the directory of the package entrypoint, eg: `some-package/dist/index.js` | ||
// so we need to walk up the tree until we find a `package.json` file to discover the root. | ||
let pluginPackageDirectory = path.dirname(createRequire(import.meta.url).resolve(packageName)); | ||
let pluginPackageDirContents = fs.readdirSync(pluginPackageDirectory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using sync
filesystem access, as calling from a synchronous context in the tailwind config
@@ -78,6 +78,12 @@ | |||
"import": "./src/plugins/index.js", | |||
"require": null, | |||
"types": "./src/plugins/index.js" | |||
}, | |||
"./plugins/discoverPluginPackageRootPathSync": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a dedicated export, as needs to be required from a commonjs
context, and esm
only modules are included in the main ./plugins
export
A few notes on this one;
|
Description
Previously the tailwind configuration only worked if the directory structure looked like:
This PR aims to replace the assumptions on possible
node_modules
locations with following the same package resolution algorithm used elsewhere in the sdk, meaning that a hoisted monorepo layout like this will now work:There remains an assumption/convention that packages must structure their artifacts into a
/dist/**/*.{html,js,svelte,ts,md}
path, but that seems fine to leave alone.Checklist