-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with relative paths inside sdl #10
Comments
+1 |
Maybe it's related to the "dependencies": {
"graphql-import": "^0.4.5"
}, |
+1 |
Nope, it's actually a bug in https://github.com/prisma/graphql-import-loader/blob/master/src/index.ts#L8 It should be |
(addendum: I just decided to switch to webpack-graphql-loader, which works roughly similar, but not as advanced on imports (it's more or less just file concatenation). |
Use the file path instead of file content to import schema. Set Jest's environment to node to avoid the error with jsdom's localStorage, see jestjs/jest#6766 and jsdom/jsdom#2304. BREAKING CHANGE: Use absolute path inside DSL won't work anymore, but now will be the same behavior of `graphql-import` dealing with paths. Fix prisma-labs#10
This is a possible fix, it also adds all the files to webpack's watch mode: import { importSchema, parseSDL } from 'graphql-import'
import { dirname, resolve } from 'path'
export default function (source) {
const callback = this.async()
this.cacheable()
parseSDL(source).forEach(rawModule => {
this.addDependency(resolve(dirname(this.resourcePath), rawModule.from))
})
callback(null, `module.exports = \`${importSchema(this.resourcePath).replace(/`/g, '\\`')}\``)
} |
Error, no such file or directory:
# import * from './myFolder/myFile.graphql'
Ok, with absolute paths:
# import * from 'src/.../myFolder/myFile.graphql'
I didnt meet any problem like this with graphql-import.
I just saw that on the documentation you have absolute paths, but what blocks to have the same behavior with the loader?
The text was updated successfully, but these errors were encountered: