diff --git a/config/jest/graphqlTransform.js b/config/jest/graphqlTransform.js new file mode 100644 index 000000000..95d4c5fd7 --- /dev/null +++ b/config/jest/graphqlTransform.js @@ -0,0 +1,18 @@ +// @remove-on-eject-begin +/** + * Copyright (c) 2018-present, Facebook, Inc. + * Copyright (c) 2016 Remind + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +// @remove-on-eject-end +'use strict'; + +const loader = require('graphql-tag/loader'); + +module.exports = { + process(src) { + return loader.call({ cacheable() {} }, src); + }, +}; \ No newline at end of file diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 924e3e4f0..346c660e8 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -183,6 +183,11 @@ module.exports = { }, ], }, + // The GraphQL loader preprocesses GraphQL queries in .graphql files. + { + test: /\.(graphql)$/, + loader: 'graphql-tag/loader', + }, // "postcss" loader applies autoprefixer to our CSS. // "css" loader resolves paths in CSS and adds assets as dependencies. // "style" loader turns CSS into JS modules that inject