require(...*.graphql) doesn't work in angular cli generated project
See original GitHub issueHey,
I am trying to apply your tutproial with a project that I created using the angular cli. Most of it is fine but I have 2 problems. Here is nr. 1 I will add nr. 2 in a second issue.
const UsersQueryNode: DocumentNode = require('graphql-tag/loader!../graphql/Users.graphql');
does not work for me, the TS compiler says:
Cannot find name ‘require’.
Not sure what the problem here is, I added the @types/node
to the tsconfig.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Configuring an Angular CLI project with GraphQL - Medium
Run the script and verify a schema.graphql was created in the root of the project. The schema is copied locally for two reasons....
Read more >Unable to run server.js when using Apollo Graphql. · Issue #736
Current behavior. I've installed "@ng-toolkit/universal": "^7.1.2 via ng add command. My project is using Apollo Graphql.
Read more >A Quick Guide to Angular and GraphQL | Okta Developer
A tutorial that shows how to create an Angular GraphQL client for a Node.js GraphQL ... To make the server work, you will...
Read more >Generate GraphQL Types with Apollo Codegen Tutorial
The command to generate TypeScript types for all GraphQL operations written in our Apollo Client project is as follows:
Read more >Working With GraphQL In Angular: How to Make a ... - Telerik
Open your command-line application and switch to the directory you'd like to keep the application. · Run git clone https://github.com/pmbanugo/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe you have a wrong tsconfig settings , Try adding
"types": ["node"]
to thecompilerOptions
in the tsconfig.app.jsonThis works fine, but webpack (Angular CLI) still logs the error on the console. Any suggestions to fix that?
Edit: Forget it, restart server solves this issue!