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

fix: exclude node_modules paths by default #41

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

antfu
Copy link
Contributor

@antfu antfu commented Apr 22, 2024

Previously, the externalization forced opt-out when the path was relative and ignored the user options. While in practice, sometime we have module like this:

import { composer } from '../node_modules/.pnpm/eslint-flat-config-utils@0.2.3/node_modules/eslint-flat-config-utils/dist/index.mjs';
import typegen from '../node_modules/.pnpm/eslint-typegen@0.2.3_eslint@9.0.0-rc.0/node_modules/eslint-typegen/dist/index.mjs';
import { createConfigForNuxt, defineFlatConfigs, resolveOptions } from '../node_modules/.pnpm/@nuxt+eslint-config@0.3.8_eslint@9.0.0-rc.0_typescript@5.4.5/node_modules/@nuxt/eslint-config/dist/flat.mjs';

// ...

Where relative or absolute paths are used to reference modules deeply. Often used by codegen with pnpm non-hoist mode, there are the packages can't not be directly imported at the location of the codegen file. In the current behavior, those files will be bundled and causing the bundled file importing module that are not hoisted (related to nuxt/eslint#400)

I think it's better to have the convention that is marked as externalized based on the presence of /node_modules/ and after the user external config, so users would still have a chance to tweak the behavior of that.

Copy link

codesandbox bot commented Apr 22, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

antfu added a commit to eslint/config-inspector that referenced this pull request Apr 22, 2024
@egoist egoist merged commit 61f98ee into egoist:main Apr 22, 2024
2 of 3 checks passed
Copy link

🎉 This PR is included in version 4.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

spencer-jacobs added a commit to spencer-jacobs/electron-builder-encryptor that referenced this pull request Apr 27, 2024
The 4.0.3 now marks node_modules as external by default which breaks things so use 4.0.2 for now
egoist/bundle-require#41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants