Skip to content
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

Merged
merged 7 commits into from
Sep 5, 2021
Merged

Add Next.js plugin #336

merged 7 commits into from
Sep 5, 2021

Conversation

markdalgleish
Copy link
Contributor

No description provided.

@markdalgleish markdalgleish requested a review from a team as a code owner September 4, 2021 15:08
@changeset-bot
Copy link

changeset-bot bot commented Sep 4, 2021

⚠️ No Changeset found

Latest commit: fc56532

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

webpack(config, options) {
const { dev, isServer } = options;

config.module.rules[config.module.rules.length - 1].oneOf.unshift({

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

Copy link
Contributor Author

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.

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')))

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 👍

@markdalgleish markdalgleish merged commit f66484c into master Sep 5, 2021
@markdalgleish markdalgleish deleted the next-plugin branch September 5, 2021 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants