Comments (13)
@v1ray to fix that run npm i -D @types/yargs
from ngx-translate-extract.
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.
@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.
@kohanets could you elaborate (i.e. show the full implementation of your solution)?
from ngx-translate-extract.
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.
@voxellotl yeah, I am doing the same but I hate being have to do that 😒
from ngx-translate-extract.
A PR with a fix is welcome. I don't use angular-cli.
from ngx-translate-extract.
It's a Webpack thing because I'm not using angular-cli
either and run into the same problem.
from ngx-translate-extract.
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.
still no luck here?
from ngx-translate-extract.
Thanks @kohanets
from ngx-translate-extract.
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.
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)
- Array value erased when extract
- Extraneous path dependency?
- Angular 13 issue HOT 51
- Extract Parser error with Array.map & join
- Key 'constructor' is not parsed HOT 1
- Translations are not extracted from object in html template
- Not working with already interpolated strings and translateParams directive
- Dynamic string in translate instant
- Translation when using <ng-content>
- Allow translation files as inputs to prevent duplicate keys in an Angular workspace
- No updates in almost a year. Is this project dead? HOT 3
- my steps and how solve my error HOT 1
- Found 0 strings. HOT 1
- Getting Error while generating extracts- Ng Version -14.0.1 HOT 5
- [Question] Can we have html tags in translation strings? HOT 1
- Labels in html files preceded by variable are not found
- How can you sort by only adding new line at the bottom
- Is there a way to extract the default values from pipes
- Error generating with Angular 16 HOT 1
- Key in angular 17 new control flow get cleaned HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-translate-extract.