-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Generate plugin list file #4725
Generate plugin list file #4725
Conversation
Removes the importing of all plugins in src/util/resolveConfig to avoid importing CSS. Import the built plugin list file instead.
scripts/create-plugin-list.js
Outdated
import * as corePlugins from '../src/plugins' | ||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
const corePluginList = Object.keys(corePlugins) | ||
|
||
fs.writeFileSync( | ||
path.join(__dirname, '..', 'src', 'corePluginList.js'), | ||
`export default ${JSON.stringify(corePluginList)}` | ||
) |
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.
Q: Since this logic is only used by resolveConfig.js
can we not generate the file and directly move this to resolveConfig.js
?
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.
This would make it so we would have to commit a generated file to the repo. It would also have to conform to the linter. Is this desired behavior?
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.
I meant something more similar to the older logic.
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.
I'm confused as to what this means. We cannot do this in resolveConfig.js
because it would mean a package consumer would have to import all the plugins and thus import CSS from the preflight
plugin. See linked issue for why this is a problem.
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.
Since exports are transpiled to commonjs, there may exist some trick to get a list of all of them. Just suppositions though.
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
Thanks, I'll publish a new release with this fix today 👍🏻 Long-term though it's still way better to not have this stuff in your client-side bundle at all. You can look at the tailwindcss.com repo if you want to see how we do this ourselves with preval. resolveConfig carries with it some really big dependencies you don't want to ship to the client. |
This actually prevents npm or yarn from installing on my system:
Edit: Using Node v12. Same result with Node V14:
|
Breaks mine too. Quick fix would be to remove the install script. @adamwathan. Strange because I actually created a discussion over at the NPM repository and was told to use this. |
Removes the importing of all plugins in
src/util/resolveConfig
to avoid importing CSS.Import the built plugin list file instead.
resolves #4681