diff --git a/node_modules/babel-plugin-import-graphql/build/index.js b/node_modules/babel-plugin-import-graphql/build/index.js index 9fd4ee6..89db384 100644 --- a/node_modules/babel-plugin-import-graphql/build/index.js +++ b/node_modules/babel-plugin-import-graphql/build/index.js @@ -57,9 +57,25 @@ var _default = function _default(_ref) { emitDeclarations = _opts$emitDeclaration === void 0 ? false : _opts$emitDeclaration; extensions = _toConsumableArray(extensions).concat(['.graphql', '.gql']); - if (extensions.some(function (extension) { - return importPath.endsWith(extension); + var absPath = resolve(importPath, jsFilename); + var fallbackPaths = opts.nodePath ? opts.nodePath.split(_path.delimiter) : [process.env.NODE_PATH]; + + if (!(0, _fs.existsSync)(absPath)) { + absPath = fallbackPaths.map(function (fallbackPath) { + if (fallbackPath) { + return (0, _path.join)(fallbackPath, importPath); + } + }).find(function (altPath) { + return (0, _fs.existsSync)(altPath); + }); + } // Analyze the file, returning one of the following... + // For schema-like files: string - the GraphQL source code + // For op/frag files: object - map of names to GraphQL Documents + + if (absPath !== undefined && extensions.some(function (extension) { + return absPath.endsWith(extension); })) { + if (opts.runtime) { try { require('graphql-tag'); @@ -68,21 +84,6 @@ var _default = function _default(_ref) { } } // Find the file, using node resolution/NODE_PATH if necessary. - - var fallbackPaths = opts.nodePath ? opts.nodePath.split(_path.delimiter) : [process.env.NODE_PATH]; - var absPath = resolve(importPath, jsFilename); - - if (!(0, _fs.existsSync)(absPath)) { - absPath = fallbackPaths.map(function (fallbackPath) { - return (0, _path.join)(fallbackPath, importPath); - }).find(function (altPath) { - return (0, _fs.existsSync)(altPath); - }); - } // Analyze the file, returning one of the following... - // For schema-like files: string - the GraphQL source code - // For op/frag files: object - map of names to GraphQL Documents - - var result = (0, _requireGql.requireGql)(absPath, { resolve, nowrap: false,