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

add external modules setting (pick by package name) #1524

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ValeryVS
Copy link

fixes #1510

@coveralls
Copy link

coveralls commented Oct 29, 2019

Coverage Status

Coverage decreased (-0.2%) to 96.289% when pulling 4b06349 on ValeryVS:add-external-modules-setting into 112a0bf on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 96.134% when pulling f3f9eca on ValeryVS:add-external-modules-setting into 112a0bf on benmosher:master.

3 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 96.134% when pulling f3f9eca on ValeryVS:add-external-modules-setting into 112a0bf on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 96.134% when pulling f3f9eca on ValeryVS:add-external-modules-setting into 112a0bf on benmosher:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 96.134% when pulling f3f9eca on ValeryVS:add-external-modules-setting into 112a0bf on benmosher:master.

@ValeryVS ValeryVS changed the title add external modules setting add external modules setting (pick by package name) Oct 30, 2019
@@ -341,6 +341,24 @@ Contribution of more such shared configs for other platforms are welcome!

An array of folders. Resolved modules only from those folders will be considered as "external". By default - `["node_modules"]`. Makes sense if you have configured your path or webpack to handle your internal paths differently and want to considered modules from some folders, for example `bower_components` or `jspm_modules`, as "external".

#### `import/external-modules`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const folders = (settings && settings['import/external-module-folders']) || ['node_modules']

// extract the part before the first / (redux-saga/effects => redux-saga)
const packageName = name.match(/([^/]+)/)[0]

return !path || folders.some(folder => -1 < path.indexOf(join(folder, packageName)))
return !path
|| folders.some(folder => -1 < path.indexOf(join(folder, packageName)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a yoda condition, and "includes" exists:

Suggested change
|| folders.some(folder => -1 < path.indexOf(join(folder, packageName)))
|| folders.some(folder => path.includes(join(folder, packageName)))

@ljharb ljharb marked this pull request as draft May 14, 2021 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Add setting to specify external modules by package name pattern
3 participants