Git Product home page Git Product logo

Comments (13)

VadimDez avatar VadimDez commented on July 30, 2024 9

@v1ray to fix that run npm i -D @types/yargs

from ngx-translate-extract.

VadimDez avatar VadimDez commented on July 30, 2024 2

When using extract marker in ts:

import { _ as extract } from '@biesbjerg/ngx-translate-extract';

getting errors with webpack

WARNING in ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/index.js
11:39-46 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/lib/apply-extends.js
27:24-55 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/require-main-filename/index.js
2:25-32 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/yargs.js
341:33-40 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/lib/apply-extends.js
42:82-105 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/yargs-parser/index.js
449:21-48 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/yargs.js
497:71-78 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./node_modules/encoding/lib/iconv-loader.js
9:12-34 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/source-map-support/source-map-support.js
Module not found: Error: Can't resolve 'module' in '/Users/..../app/node_modules/source-map-support'
 @ ./node_modules/source-map-support/source-map-support.js 474:15-32
 @ ./node_modules/typescript/lib/typescript.js
 @ ./node_modules/@biesbjerg/ngx-translate-extract/dist/parsers/abstract-ast.parser.js
 @ ./node_modules/@biesbjerg/ngx-translate-extract/dist/index.js
 @ ./src/app/settings/function-keys/function-keys.component.ts
 @ ./src/app/settings/settings.module.ts
 @ ./src/main.ts

WARNING in ./node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'spawn-sync' in '/Users/..../app/node_modules/cross-spawn'
 @ ./node_modules/cross-spawn/index.js 32:26-47
 @ ./node_modules/execa/index.js
 @ ./node_modules/os-locale/index.js
 @ ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/yargs.js
 @ ./node_modules/@biesbjerg/ngx-translate-extract/node_modules/yargs/index.js
 @ ./node_modules/@biesbjerg/ngx-translate-extract/dist/cli/cli.js
 @ ./node_modules/@biesbjerg/ngx-translate-extract/dist/index.js
 @ ./src/app/settings/function-keys/function-keys.component.ts
 @ ./src/app/settings/settings.module.ts
 @ ./src/main.ts

ERROR in [at-loader] ./node_modules/@biesbjerg/ngx-translate-extract/dist/cli/cli.d.ts:1:23 
    TS2688: Cannot find type definition file for 'yargs'.
Child html-webpack-plugin for "index.html":

from ngx-translate-extract.

kohanets avatar kohanets commented on July 30, 2024 1

@amnporter
Issues with Angular CLI
It seems that using the marker function in the ngx-translate-extract bundle currently does not work with AnguarCLI. ng serve is reporting the following error:

…/@biesbjerg/ngx-translate-extract/dist/cli/cli.d.ts (1,1): Cannot find type definition file for 'yargs'.
The best workaround for this is to add your own marker function in a separate translation-marker.ts file:

export function _(str: string) {
return str;
}
And import it using

import { _ } from './translation-marker';

from ngx-translate-extract.

takahser avatar takahser commented on July 30, 2024 1

@kohanets could you elaborate (i.e. show the full implementation of your solution)?

from ngx-translate-extract.

mthomas-io avatar mthomas-io commented on July 30, 2024

Got this same problem, for now I comment out the extraction strings and import and only un-comment when running the extraction command. Hope to see a solution for this soon too..

from ngx-translate-extract.

burhanyldz avatar burhanyldz commented on July 30, 2024

@voxellotl yeah, I am doing the same but I hate being have to do that 😒

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

A PR with a fix is welcome. I don't use angular-cli.

from ngx-translate-extract.

JJBocanegra avatar JJBocanegra commented on July 30, 2024

It's a Webpack thing because I'm not using angular-cli either and run into the same problem.

from ngx-translate-extract.

51Ray avatar 51Ray commented on July 30, 2024

ERROR in [at-loader] ./node_modules/@biesbjerg/ngx-translate-extract/dist/cli/cli.d.ts:1:23
TS2688: Cannot find type definition file for 'yargs'.

I get the same error as you do. How to solve this problem?

from ngx-translate-extract.

amnporter avatar amnporter commented on July 30, 2024

still no luck here?

from ngx-translate-extract.

amnporter avatar amnporter commented on July 30, 2024

Thanks @kohanets

from ngx-translate-extract.

rybaczewa avatar rybaczewa commented on July 30, 2024

Issue is duplicated. This one shows first on google, but newer has more solutions (#63). I think this one can be closed?

from ngx-translate-extract.

biesbjerg avatar biesbjerg commented on July 30, 2024

I've created a separate package for the marker function.

npm install @biesbjerg/ngx-translate-extract-marker

import { marker } from '@biesbjerg/ngx-translate-extract-marker';

from ngx-translate-extract.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.