question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

require(...*.graphql) doesn't work in angular cli generated project

See original GitHub issue

Hey,

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:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
eitanfrcommented, Jun 26, 2017

Maybe you have a wrong tsconfig settings , Try adding "types": ["node"] to the compilerOptions in the tsconfig.app.json

0reactions
loxycommented, May 19, 2018

This 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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found