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

Nested files inside externals are still included in bundle #16

Open
elado opened this issue Oct 11, 2019 · 1 comment
Open

Nested files inside externals are still included in bundle #16

elado opened this issue Oct 11, 2019 · 1 comment

Comments

@elado
Copy link

elado commented Oct 11, 2019

For example, a package with next as a dependency in package.json, but has an import App from 'next/app' inside it, includes the entire source of next/app instead of treating it as an external.

The workaround is to include next/app as an external in rollup config, manually.

@elado
Copy link
Author

elado commented Nov 21, 2019

This plugin fixes it https://github.com/Septh/rollup-plugin-node-externals

agilgur5 added a commit to agilgur5/ts-library-base that referenced this issue Jun 14, 2022
Basically same as agilgur5/react-signature-canvas@0154531
- c.f. https://github.com/Septh/rollup-plugin-node-externals

- instead of the custom JS code I wrote
  - I was thinking of separating that into a plugin, but someone alreadydid that!
    - and, importantly, also covered submodules, unlike _most_ of the externals plugins (e.g. stevenbenisek/rollup-plugin-auto-external#16)
      - see regex here: https://github.com/Septh/rollup-plugin-node-externals/blob/11a7b4454f57c76436e71ecead0cc59ab0cc3b80/src/index.ts#L106

- put it _before_ `node-resolve` as the docs state

- reduces my code a bit, which is always nice, and will make it easier to split my Rollup config into its own "preset" package later on
somewhatabstract added a commit to Khan/wonder-blocks that referenced this issue Jul 12, 2024
## Summary:
Turns out that the rollup plugin, autoexternals, doesn't handle sub-package improts, like `react-dom/server`. However, reading the issue report on that package, [I saw a link to another](stevenbenisek/rollup-plugin-auto-external#16 (comment)), more up-to-date package, that does handle this. So I switched to that package, and now everything works as expected.

I did have to explicitly use the `mjs` extension for the rollup config, but that's a small price to pay for the benefits of the new package.

Issue: XXX-XXXX

## Test plan:
`yarn build` to see that the build works.

I'll also verify the packages in webapp to check everything else is fine, though the storybook should also check out.

Author: somewhatabstract

Reviewers: jandrade

Required Reviewers:

Approved By: jandrade

Checks: ✅ codecov/project, ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Lint (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Lint (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), 🚫 Chromatic - Get results on regular PRs, ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ✅ Publish npm snapshot (ubuntu-latest, 20.x), 🚫 Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ⏭️  Chromatic - Skip on Release PR (changesets), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ⏭️  dependabot

Pull Request URL: #2272
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

No branches or pull requests

1 participant