Skip to content

Commit d70e255

Browse files
committed
Initial commit
0 parents  commit d70e255

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

README.MD

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# react-app-rewire-graphql-tag
2+
3+
## Usage:
4+
5+
Make sure you have installed [react-app-rewire] (https://github.com/timarney/react-app-rewired),
6+
```
7+
yarn add react-app-rewire-graphql-tag
8+
```
9+
in config-overrides.js:
10+
```
11+
const rewireGqlTag = require('react-app-rewire-graphql-tag');
12+
13+
module.exports = function override(config, env) {
14+
conf = rewireGqlTag(config,env);
15+
return conf;
16+
}
17+
```

index.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
function rewireGraphQLTag(config, env) {
3+
const gqlTagExtension = /\.(graphql|gql)$/
4+
5+
const fileLoader = config.module.rules.find(rule=> rule.loader && rule.loader.indexOf("file-loader")!==-1);
6+
fileLoader.exclude.push(gqlExtension);
7+
8+
const gqlTagRule = {
9+
test: gqlTagExtension,
10+
loader: 'graphql-tag/loader',
11+
exclude: /node_modules/
12+
}
13+
config.module.rules.push(gqlTagRule);
14+
15+
return config;
16+
}
17+
18+
module.exports = rewireGraphQLTag;

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "react-app-rewire-graphql-tag",
3+
"version": "1.0.0",
4+
"description": "rewire your react-app and use graphql-tag",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"dependencies": {
10+
"graphql-tag": "^2.4.2",
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/tkvw/react-app-rewire-graphql-tag.git"
15+
},
16+
"author": "Dennie de Lange",
17+
"license": "MIT",
18+
"bugs": {
19+
"url": "https://github.com/tkvw/react-app-rewire-graphql-tag/issues"
20+
},
21+
"homepage": "https://github.com/tkvw/react-app-rewire-graphql-tag#readme"
22+
}

0 commit comments

Comments
 (0)