diff --git a/index.js b/index.js index 1cf9283..d041bb0 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,10 @@ function rewireGraphQLTag(config, env) { const gqlExtension = /\.(graphql|gql)$/ - const fileLoader = config.module.rules.find(rule=> rule.loader && rule.loader.indexOf("file-loader")!==-1); - fileLoader.exclude.push(gqlExtension); + const fileLoader = flatten(config.module.rules.map((rule) => rule.oneOf || rule)) + .find((rule) => rule.loader && rule.loader.indexOf("file-loader")!==-1); + + fileLoader && fileLoader.exclude.push(gqlExtension); const gqlTagRule = { test: gqlExtension, diff --git a/package.json b/package.json index 2d4b7ad..ab1acdd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-app-rewire-graphql-tag", - "version": "1.0.0", + "version": "1.1.0", "description": "rewire your react-app and use graphql-tag", "main": "index.js", "scripts": {