-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix(remix-dev/vite): set same config.mode
for child compiler
#7911
fix(remix-dev/vite): set same config.mode
for child compiler
#7911
Conversation
🦋 Changeset detectedLatest commit: 0a30c7b The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
config.mode
for child compilerconfig.mode
for child compiler
5b24cd1
to
324746a
Compare
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.
Thanks for the PR! I've added some tests too. I went with MDX-specific tests for this so that we're also testing MDX can be used as routes.
Thanks for adding tests. Looks good!. |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
Closes: #7901
I wrote a longer explanation here while investigating it #7901 (comment)
This specific issue of mdx rollup plugin is due to that single plugin instance's hook
{ config(config, env) => .. }
is run twice with differentenv.mode
and child compiler'sconfig
hook runs later and it overwrites plugin's internal state which then affects parent compiler's transform /~https://github.com/mdx-js/mdx/blob/efff74e48aec9286c62185bf04f7b8aa72e07bd6/packages/rollup/lib/index.js#L76-L82Note that this change only tries to align
env.mode
between parent and child compilers.env.command
is still inconsistent duringvite build
where parent hascommand = "build"
while child hascommand = "serve"
.So, this change probably doesn't help more complicated case and thus this is nothing but quick workaround for mdx plugin.
Nonetheless, starting with having consistent
env.mode
won't probably do any harm, so that's my main rational for this PR.Testing Strategy:
Confirmed this fix the reproduction from #7901 by
patch-package @remix-run/dev
with a following patch:I wasn't sure if this PR warrants new test to verify the behavior.
Please let me know if it's desired to add test (for example, integration test with
@mdx/rollup
for both dev/build, or using dummy plugin like in #7901 (comment) to verify this specificenv.mode
behavior).