Skip to content

Commit 56d7058

Browse files
author
agonbina
committed
Add support for loading graphql queries
1 parent 2abab81 commit 56d7058

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/react-scripts/config/webpack.config.dev.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module.exports = {
8686
// We also include JSX as a common component filename extension to support
8787
// some tools, although we do not recommend using it, see:
8888
// https://github.com/facebookincubator/create-react-app/issues/290
89-
extensions: ['.ts', '.tsx', '.js', '.json', '.jsx', ''],
89+
extensions: ['.gql', '.graphql', '.ts', '.tsx', '.js', '.json', '.jsx', ''],
9090
alias: {
9191
// Support React Native Web
9292
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -122,6 +122,7 @@ module.exports = {
122122
// Otherwise, it acts like the "file" loader.
123123
{
124124
exclude: [
125+
/\.(graphql|gql)$/,
125126
/\.html$/,
126127
/\.(js|jsx)$/,
127128
/\.(ts|tsx)$/,
@@ -135,6 +136,11 @@ module.exports = {
135136
name: 'static/media/[name].[hash:8].[ext]'
136137
}
137138
},
139+
{
140+
test: /\.(graphql|gql)$/,
141+
exclude: /node_modules/,
142+
loader: 'graphql-tag/loader'
143+
},
138144
// Compile .tsx?
139145
{
140146
test: /\.(ts|tsx)$/,

packages/react-scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"file-loader": "0.10.0",
3636
"filesize": "3.3.0",
3737
"fs-extra": "0.30.0",
38+
"graphql-tag": "^1.2.4",
3839
"gzip-size": "3.0.0",
3940
"html-webpack-plugin": "2.24.0",
4041
"http-proxy-middleware": "0.17.3",

0 commit comments

Comments
 (0)