-
Notifications
You must be signed in to change notification settings - Fork 291
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
Add Next.js plugin #336
Add Next.js plugin #336
Conversation
|
packages/next-plugin/src/index.js
Outdated
webpack(config, options) { | ||
const { dev, isServer } = options; | ||
|
||
config.module.rules[config.module.rules.length - 1].oneOf.unshift({ |
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 think there's no guarantee the css related rules are last because other plugins might have pushed to config.module.rules
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.
Yep, that's a good point. I'll see it I can figure out a good way to detect which item in the array should be modified.
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.
maybe something like config.module.rules.find(rule => Array.isArray(rule.oneOf) && rule.oneOf.some(r => r.test.test('test.css')))
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.
Yep, I was thinking something like this.
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.
Pushed an update to make this work similar to how you suggested. Thanks for the feedback 👍
No description provided.