Skip to content

Move rollup configs to individual packages#3376

Merged
chaance merged 61 commits into
devfrom
brophdawg11/rollup-prep
Jul 8, 2022
Merged

Move rollup configs to individual packages#3376
chaance merged 61 commits into
devfrom
brophdawg11/rollup-prep

Conversation

@brophdawg11

Copy link
Copy Markdown
Contributor

This PR splits the root rollup.config.js file out to individual packages/{name}/rollup.config.js files, and adjusts the root rollup.config.js file to read all packages/{name}/rollup.config.js files to auto-generat the root config. This is similar in nature to the jest approach this repo is using.

This has two primary benefits:

  • In preparation for the repo merge, I'll be making the same change in react-router (once we merge the remixing branch) and aligning react-router to use the same exact approach and rollup.utils.js file. This means that we do not have to merge the root rollup.config.js file from remix into react-router at all. When we migrate the remix packages/* folders, they will bring along the package-specific rollup.config.js files, and the react-router root rollup.config.js file will just automatically pick up on them 😄
  • We can now do individual package builds via npx rollup -c directly from within a packages/{name} directory if we don't need to build everything. This also "just works" with things like LOCAL_BUILD_DIRECTORY and rollup -w - both from the root and from individual packages

To test, I ran fresh builds on both dev and this branch and ensured diff -rq build-dev/ build-branch/ didn't report any differences.

Comment thread DEVELOPMENT.md Outdated
Comment thread package.json Outdated
Comment thread packages/create-remix/rollup.config.js Outdated
Comment thread packages/create-remix/rollup.config.js Outdated
Comment thread rollup.utils.js Outdated
mcansh
mcansh approved these changes Jun 3, 2022
Comment thread packages/remix-cloudflare-pages/rollup.config.js Outdated
Comment thread packages/remix-cloudflare-workers/rollup.config.js Outdated
Comment thread packages/remix-cloudflare/rollup.config.js Outdated
Comment thread packages/remix-deno/rollup.config.js Outdated
Comment thread packages/remix-dev/rollup.config.js Outdated
Comment thread packages/remix-react/rollup.config.js Outdated
Comment thread packages/remix-serve/rollup.config.js Outdated
Comment thread packages/remix-server-runtime/rollup.config.js Outdated
Comment thread packages/remix/rollup.config.js Outdated
Comment thread rollup.utils.js Outdated
Comment thread packages/create-remix/rollup.config.js Outdated
@pcattori pcattori force-pushed the brophdawg11/rollup-prep branch from f8cee27 to 2a14bf1 Compare June 9, 2022 19:22
Comment thread rollup.config.js Outdated
@pcattori pcattori force-pushed the brophdawg11/rollup-prep branch 2 times, most recently from 1a9ec85 to 716dc90 Compare June 9, 2022 19:55
@pcattori pcattori force-pushed the brophdawg11/rollup-prep branch from 716dc90 to 357232c Compare June 9, 2022 20:00
@pcattori pcattori force-pushed the brophdawg11/rollup-prep branch from c4490ae to 7a629b0 Compare June 9, 2022 20:10
@chaance chaance self-assigned this Jun 24, 2022
Comment thread packages/remix/rollup.config.js
Comment thread packages/remix/rollup.config.js Outdated
Comment thread packages/create-remix/rollup.config.js Outdated
Comment thread scripts/copy-build-to-dist.mjs
@pcattori

pcattori commented Jun 28, 2022

Copy link
Copy Markdown
Contributor

@pcattori I ended up backing out of the index abstraction you added. There were a few subtle differences between them that seemed made a difference in the output without passing several additional arguments, so I figured I'd keep the original in tact for now.

Let me know if you think I missed anything and we can re-visit!

The main value add for the abstractions were the magicExport helpers and those have been obsoleted by the work to move the magic exports out of their source packages. Was nice to see which things had magic exports in a declarative way. index and cli were just some low-hanging fruit, but not the main value for the abstractions IMO.

So yea, this makes sense!

@brophdawg11

Copy link
Copy Markdown
Contributor Author

Hey this is passing windows CI tests now?? 🥳 Any idea why?

@changeset-bot

changeset-bot Bot commented Jul 7, 2022

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5a40258

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

@chaance

chaance commented Jul 7, 2022

Copy link
Copy Markdown
Contributor

@brophdawg11 Should be good for another pass here.

Hey this is passing windows CI tests now?? 🥳 Any idea why?

My rule of thumb is to never ask this question and just be thankful (meaning, I have no idea why 😅)

@chaance chaance requested a review from MichaelDeBoey July 7, 2022 23:36
Comment thread packages/remix-dev/rollup.config.js
@brophdawg11

Copy link
Copy Markdown
Contributor Author

Looking good! I ran a fresh build on dev and this branch and found a few small magic exports deltas - but unsure if I know which is correct:

  • This branch has export type { UploadHandler, UploadHandlerPart } from '@remix-run/node' in @remix-run/architect/dist/magicExports/remix.d.ts and dev does not
  • dev exports ActionArgs and LoaderArgs in @remix-run/server-runtime/dist/magicExports/remix.d.ts but this branch does not

Otherwise the builds looked identical minus two small /* webpackIgnore: true */ comments on some dynamic imports

@MichaelDeBoey

Copy link
Copy Markdown
Member
  • This branch has export type { UploadHandler, UploadHandlerPart } from '@remix-run/node' in @remix-run/architect/dist/magicExports/remix.d.ts and dev does not
  • dev exports ActionArgs and LoaderArgs in @remix-run/server-runtime/dist/magicExports/remix.d.ts but this branch does not

This should be like we have on dev

@chaance

chaance commented Jul 8, 2022

Copy link
Copy Markdown
Contributor

@brophdawg11 Addressed both of those issues. Confirmed that magic exports match what's on dev, and the webpack comment should be included here 👍

@chaance chaance merged commit 2a59335 into dev Jul 8, 2022
@chaance chaance deleted the brophdawg11/rollup-prep branch July 8, 2022 22:57
@github-actions

github-actions Bot commented Jul 9, 2022

Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-2a59335-20220709 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!

@ronnylt

ronnylt commented Jul 26, 2022

Copy link
Copy Markdown
Contributor

We can now do individual package builds via npx rollup -c directly from within a packages/{name} directory if we don't need to build everything. This also "just works" with things like LOCAL_BUILD_DIRECTORY and rollup -w - both from the root and from individual packages

I am trying to build individual packages but it's not working:


remix/packages/remix-vercel (dev ✔) ᐅ npx rollup -c

packages/remix-vercel/index.ts → build/node_modules/@remix-run/vercel/dist...
[!] Error: Could not resolve entry module (packages/remix-vercel/index.ts).
Error: Could not resolve entry module (packages/remix-vercel/index.ts).
    at error (/Users/ronnylt/Workspace/opensource/remix/node_modules/rollup/dist/shared/rollup.js:198:30)
    at ModuleLoader.loadEntryModule (/Users/ronnylt/Workspace/opensource/remix/node_modules/rollup/dist/shared/rollup.js:22527:20)
    at async Promise.all (index 0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants