Closed yalamber closed 4 years ago
Hi @yalamber !
When you run compiled JavaScript files from another directory, it looks for graphql
files in that directory. Since you still have graphql
files in your directory and don't have those in output directory, it fails.
graphql-import-node
is just a NodeJS extension that helps NodeJS to handle .graphql
files in its builtin require
command. So you are responsible to copy them because tsc
will only create js
files for you.
Hello @ardatan thank you for quick reply, So I am using graphql modules https://graphql-modules.com/ and have .graphql files in different folders, So If I run post build script which copies those .graphql files to respective folders it should work fine right?
@yalamber Yes. That should do the trick. Let me know if it doesn't :)
Thanks @ardatan I added following scripts
"build": "tsc && npm run copy-graphql",
"copy-graphql": "copyfiles -u 1 src/modules/**/*.graphql dist",
this copied .graphql files to required directories in dist and works fine for now :)
Sounds awesome! Feel free to open a new issue if you have more questions :)
I am using this module and it seems to be working for development well. I have following script setup
My main.ts file
tsconfig.json file
Now this works when I do npm run dev just fine. npm run build also builds in dist folder fine. But when I run npm start, It shows missing .graphql error. I see .graphql files are not being copied.