Skip to content

Commit 1ed239f

Browse files
committed
Flatten rules after oneOf was added to create-react-app webpack configs
see facebook/create-react-app#2747
1 parent 2157950 commit 1ed239f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
function rewireGraphQLTag(config, env) {
33
const gqlExtension = /\.(graphql|gql)$/
44

5-
const fileLoader = config.module.rules.find(rule=> rule.loader && rule.loader.indexOf("file-loader")!==-1);
6-
fileLoader.exclude.push(gqlExtension);
5+
const fileLoader = flatten(config.module.rules.map((rule) => rule.oneOf || rule))
6+
.find((rule) => rule.loader && rule.loader.indexOf("file-loader")!==-1);
7+
8+
fileLoader && fileLoader.exclude.push(gqlExtension);
79

810
const gqlTagRule = {
911
test: gqlExtension,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-app-rewire-graphql-tag",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "rewire your react-app and use graphql-tag",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)