diff --git a/.changeset/drop-lodash-get.md b/.changeset/drop-lodash-get.md new file mode 100644 index 00000000000..2d630d65a64 --- /dev/null +++ b/.changeset/drop-lodash-get.md @@ -0,0 +1,5 @@ +--- +'@module-federation/typescript': patch +--- + +chore(typescript): drop `lodash.get` dependency in favor of optional chaining in `normalizeOptions`. diff --git a/package.json b/package.json index ec7ce966ee4..55f262fddd0 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,6 @@ "express": "5.2.1", "fast-glob": "3.3.3", "glob": "^11.0.0", - "lodash.get": "4.4.2", "openai": "^6.27.0", "rambda": "11.1.0", "regenerator-runtime": "0.14.1", @@ -222,7 +221,6 @@ "@types/fs-extra": "9.0.13", "@types/jest": "29.5.13", "@types/lodash.clonedeepwith": "^4.5.9", - "@types/lodash.get": "4.4.9", "@types/minimatch": "^5.1.2", "@types/node": "20.19.5", "@types/node-fetch": "2.6.11", diff --git a/packages/typescript/package.json b/packages/typescript/package.json index 9b721bd376d..6b227771707 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -44,7 +44,6 @@ }, "dependencies": { "axios": "1.15.0", - "lodash.get": "4.4.2", "node-fetch": "2.7.0", "tapable": "2.3.0" }, diff --git a/packages/typescript/src/lib/normalizeOptions.ts b/packages/typescript/src/lib/normalizeOptions.ts index a2600ebcd52..5f4ae437bbf 100644 --- a/packages/typescript/src/lib/normalizeOptions.ts +++ b/packages/typescript/src/lib/normalizeOptions.ts @@ -1,6 +1,5 @@ import ts from 'typescript'; import { Compiler } from 'webpack'; -import get from 'lodash.get'; import path from 'path'; import type { FederatedTypesPluginOptions, TypeServeOptions } from '../types'; @@ -80,9 +79,14 @@ export const normalizeOptions = ( const federationFileName = (federationConfig.filename ?? 'remoteEntry.js') as string; + const devServer = ( + webpackCompilerOptions as { + devServer?: { static?: { directory?: string } }; + } + ).devServer; const distPath = - get(webpackCompilerOptions, 'devServer.static.directory') || - get(webpackCompilerOptions, 'output.path') || + devServer?.static?.directory || + webpackCompilerOptions.output?.path || 'dist'; const typesPath = federationFileName.substring( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e13c22a0d9..57447a6f9bd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,9 +44,6 @@ importers: glob: specifier: ^11.0.0 version: 11.1.0 - lodash.get: - specifier: 4.4.2 - version: 4.4.2 openai: specifier: ^6.27.0 version: 6.31.0(ws@8.20.0)(zod@4.1.12) @@ -192,9 +189,6 @@ importers: '@types/lodash.clonedeepwith': specifier: ^4.5.9 version: 4.5.9 - '@types/lodash.get': - specifier: 4.4.9 - version: 4.4.9 '@types/minimatch': specifier: ^5.1.2 version: 5.1.2 @@ -4391,9 +4385,6 @@ importers: axios: specifier: 1.15.0 version: 1.15.0 - lodash.get: - specifier: 4.4.2 - version: 4.4.2 next: specifier: '*' version: 16.1.5(@babel/core@7.29.0)(@playwright/test@1.57.0)(@swc/core@1.7.26(@swc/helpers@0.5.13))(babel-plugin-macros@3.1.0)(esbuild@0.27.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.98.0)(webpack-cli@5.1.4) @@ -13252,9 +13243,6 @@ packages: '@types/lodash.clonedeepwith@4.5.9': resolution: {integrity: sha512-bruhfxIJlj36oWYmYQ7KFbylCGgzyIi+TLypub+wcAd29mV4llKdvru8Pp9qwILX//I5vK3FIcJ0VzszElhLuA==} - '@types/lodash.get@4.4.9': - resolution: {integrity: sha512-J5dvW98sxmGnamqf+/aLP87PYXyrha9xIgc2ZlHl6OHMFR2Ejdxep50QfU0abO1+CH6+ugx+8wEUN1toImAinA==} - '@types/lodash@4.17.24': resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==} @@ -19880,10 +19868,6 @@ packages: lodash.debounce@4.0.8: resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} - lodash.get@4.4.2: - resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} - deprecated: This package is deprecated. Use the optional chaining (?.) operator instead. - lodash.isplainobject@4.0.6: resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} @@ -39366,10 +39350,6 @@ snapshots: dependencies: '@types/lodash': 4.17.24 - '@types/lodash.get@4.4.9': - dependencies: - '@types/lodash': 4.17.24 - '@types/lodash@4.17.24': {} '@types/mdast@3.0.15': @@ -48808,8 +48788,6 @@ snapshots: lodash.debounce@4.0.8: {} - lodash.get@4.4.2: {} - lodash.isplainobject@4.0.6: {} lodash.kebabcase@4.1.1: {}