Skip to content

Commit

Permalink
Misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Septh committed Jun 2, 2023
1 parent 942d055 commit bca602e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ const isString = (str: unknown): str is string =>
function nodeExternals(options: ExternalsOptions = {}): Plugin {

const config: Config = { ...defaults, ...options }

let include: RegExp[],
exclude: RegExp[]

const isIncluded = (id: string) => include.some(rx => rx.test(id)),
isExcluded = (id: string) => exclude.some(rx => rx.test(id))

Expand All @@ -157,11 +159,9 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
// Populate the packagePath option if not given by getting all package.json files
// from cwd up to the root of the git repo, the root of the monorepo,
// or the root of the volume, whichever comes first.
const packagePaths: string[] = Array.isArray(config.packagePath)
? config.packagePath.filter(isString)
: isString(config.packagePath)
? [ config.packagePath ]
: []
const packagePaths = ([] as string[])
.concat(config['packagePath'])
.filter(isString)
if (packagePaths.length === 0) {
for (
let current = process.cwd(), previous: string | undefined;
Expand Down Expand Up @@ -239,7 +239,7 @@ function nodeExternals(options: ExternalsOptions = {}): Plugin {
: config.builtinsPrefix === 'add' || builtins.alwaysPrefixed.has(id)
? nodePrefix + stripped
: stripped,
external: config.builtins && !isExcluded(id),
external: config.builtins && !isExcluded(id),
moduleSideEffects: false
}
}
Expand Down

0 comments on commit bca602e

Please sign in to comment.