Skip to content

Commit

Permalink
fix: only externalize @types/ from devDependencies (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Dec 27, 2024
1 parent 9dd09ee commit 9360293
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ export function inferPkgExternals(pkg: PackageJson): (string | RegExp)[] {
const externals: (string | RegExp)[] = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.devDependencies || {}),
...Object.keys(pkg.devDependencies || {}).filter((dep) =>
dep.startsWith("@types/"),
),
...Object.keys(pkg.optionalDependencies || {}),
];

Expand Down
2 changes: 1 addition & 1 deletion test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("inferPkgExternals", () => {
name: "test",
dependencies: { react: "17.0.0" },
peerDependencies: { "react-dom": "17.0.0" },
devDependencies: { "@types/react": "17.0.0" },
devDependencies: { "@types/react": "17.0.0", webpack: "*" },
optionalDependencies: { test: "1.0.0", optional: "1.0.0" },
exports: {
".": "index.js",
Expand Down

0 comments on commit 9360293

Please sign in to comment.