remix icon indicating copy to clipboard operation
remix copied to clipboard

feat(remix-dev): deprecate `serverBuildTarget`

Open MichaelDeBoey opened this issue 2 years ago • 9 comments

As discussed in the second roadmap livestream


Closes #3556

MichaelDeBoey avatar Dec 12 '22 23:12 MichaelDeBoey

⚠️ No Changeset found

Latest commit: bdc6ff1062b53b439f252308dab3674bece74966

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

changeset-bot[bot] avatar Dec 12 '22 23:12 changeset-bot[bot]

Between this and #4842 are we missing anything? I see there are some places where we key off of this in the compiler (e.g. here), do we need additional config to support this behavior?

jenseng avatar Dec 12 '22 23:12 jenseng

@jenseng Good call! That's indeed something we need to figure out in some other way 🤔

Listing all the usages:

  • https://github.com/remix-run/remix/blob/6a6fa5911e09667c1788451512956ba636aca043/packages/remix-dev/compiler/compilerServer.ts#L45-L48
  • https://github.com/remix-run/remix/blob/6a6fa5911e09667c1788451512956ba636aca043/packages/remix-dev/compiler/plugins/serverBareModulesPlugin.ts#L24
  • https://github.com/remix-run/remix/blob/6a6fa5911e09667c1788451512956ba636aca043/packages/remix-dev/compiler/plugins/serverBareModulesPlugin.ts#L95-L101
  • https://github.com/remix-run/remix/blob/6a6fa5911e09667c1788451512956ba636aca043/packages/remix-dev/compiler/plugins/serverBareModulesPlugin.ts#L116-L117

MichaelDeBoey avatar Dec 13 '22 00:12 MichaelDeBoey

@Harmony7 mentioned the same problem in #4860 regarding not being able to fully deprecate serverBuildtarget

This PR is necessary because, except for the first two subitems in the list above, these behaviors cannot be set through remix.config.js.

MichaelDeBoey avatar Dec 14 '22 10:12 MichaelDeBoey

Looks like this is going to be solving https://github.com/remix-run/remix/discussions/4615 that was one of my concerns, too. Thanks.

harmony7 avatar Dec 14 '22 13:12 harmony7

bundling everything should be achievable using serverDependenciesToBundle: /.*/, but still need a way to set conditions, minify, and mainfield for esbuild

mcansh avatar Dec 14 '22 14:12 mcansh

@mcansh So how do you think that would that look like? Creating new serverConditions, serverMinify & serverMainFields config options?

If so, I would suggest to go with a server object instead, to not pollute the global config namespace.

CC/ @mjackson @ryanflorence

MichaelDeBoey avatar Dec 14 '22 15:12 MichaelDeBoey

new serverConditions, serverMinify & serverMainFields config options

Yeah, @MichaelDeBoey. I think we will need these.

If so, I would suggest to go with a server object instead, to not pollute the global config namespace.

No, let's keep the config object as flat as possible.

mjackson avatar Jan 19 '23 01:01 mjackson

@mjackson I introduced the serverConditions, serverMinify & serverMainFields config options and updated serverDependenciesToBundle so that it can also receive "all" as value.

The only places where we're now still using serverBuildTarget is in serverBareModulesPlugin:

  • https://github.com/remix-run/remix/blob/6a6fa5911e09667c1788451512956ba636aca043/packages/remix-dev/compiler/plugins/serverBareModulesPlugin.ts#L24-L37
  • https://github.com/remix-run/remix/blob/6a6fa5911e09667c1788451512956ba636aca043/packages/remix-dev/compiler/plugins/serverBareModulesPlugin.ts#L116-L117

Can't think of a good way to remove usage here though 🤔

CC/ @jacob-ebey @mcansh @pcattori as you have been working in this file on the parts that still need a solution.

MichaelDeBoey avatar Jan 22 '23 01:01 MichaelDeBoey

awesome stuff! =)

harmony7 avatar Feb 03 '23 01:02 harmony7

🤖 Hello there,

We just published version v0.0.0-nightly-79859c9-20230203 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

github-actions[bot] avatar Feb 03 '23 15:02 github-actions[bot]

Client conditions would be useful too https://github.com/remix-run/remix/discussions/6003

TrySound avatar Apr 05 '23 13:04 TrySound