Skip to content

Commit

Permalink
fix(apollo-mock-server): check if graphql-tag/loader is already added
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiode committed Dec 17, 2019
1 parent 42c6e72 commit 83dc87b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/apollo-mock-server/mixin.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ class GraphQLMixin extends Mixin {
configureBuild(webpackConfig, loaderConfigs, target) {
const { allLoaderConfigs } = loaderConfigs;

allLoaderConfigs.splice(allLoaderConfigs.length - 1, 0, {
test: /\.(graphql|gql)$/,
loader: 'graphql-tag/loader',
});
if (
!allLoaderConfigs.find(({ loader }) => loader === 'graphql-tag/loader')
) {
allLoaderConfigs.splice(allLoaderConfigs.length - 1, 0, {
test: /\.(graphql|gql)$/,
loader: 'graphql-tag/loader',
});
}

webpackConfig.externals.push('encoding');

Expand Down

0 comments on commit 83dc87b

Please sign in to comment.