diff --git a/packages/cli/src/api/extractors/index.ts b/packages/cli/src/api/extractors/index.ts index 8eaa773cd..fa82c0fc8 100644 --- a/packages/cli/src/api/extractors/index.ts +++ b/packages/cli/src/api/extractors/index.ts @@ -20,16 +20,7 @@ export default async function extract( ): Promise { const extractorsToExtract = options.extractors ?? DEFAULT_EXTRACTORS - for (let e of extractorsToExtract) { - let ext: ExtractorType = e - if (typeof e === "string") { - // in case of the user using require.resolve in their extractors, we require that module - ext = require(e) - } - if ((ext as any).default) { - ext = (ext as any).default - } - + for (let ext of extractorsToExtract) { if (!ext.match(filename)) continue try { diff --git a/packages/conf/__typetests__/index.test-d.tsx b/packages/conf/__typetests__/index.test-d.tsx index 1f582b46e..00ca4aa2b 100644 --- a/packages/conf/__typetests__/index.test-d.tsx +++ b/packages/conf/__typetests__/index.test-d.tsx @@ -48,7 +48,6 @@ expectAssignable({ expectAssignable({ locales: ["en", "pl"], extractors: [ - "babel", { match: (fileName: string) => false, extract: ( diff --git a/packages/conf/src/types.ts b/packages/conf/src/types.ts index e814c3fd3..29c2d658f 100644 --- a/packages/conf/src/types.ts +++ b/packages/conf/src/types.ts @@ -199,7 +199,7 @@ export type LinguiConfig = { } compilerBabelOptions?: any fallbackLocales?: FallbackLocales | false - extractors?: (string | ExtractorType)[] + extractors?: ExtractorType[] prevFormat?: CatalogFormat localeDir?: string format?: CatalogFormat | CatalogFormatter diff --git a/website/docs/releases/migration-5.md b/website/docs/releases/migration-5.md index beabcc8d9..efb9f5d92 100644 --- a/website/docs/releases/migration-5.md +++ b/website/docs/releases/migration-5.md @@ -203,3 +203,5 @@ You'll need to [re-compile](/docs/ref/cli.md#compile) your messages in the new f ## Deprecations and Removals - Removed the deprecated `isTranslated` prop from the React `Trans` component. +- Removed support of the module path strings in `LinguiConfig.extractors` property. Please pass extractor object directly. +