Skip to content

Commit

Permalink
fix: use graphql-relay-js from GitHub
Browse files Browse the repository at this point in the history
This is to allow Webpack to see through this module and correctly
eliminate unused parts of graphql-js.

See also graphql/graphql-relay-js#208
  • Loading branch information
motiz88 committed Apr 15, 2018
1 parent 924edf4 commit 6d94025
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"express": "^4.16.3",
"express-graphql": "^0.6.12",
"graphql": "0.13.2",
"graphql-relay": "0.5.5"
"graphql-relay": "graphql/graphql-relay-js"
},
"devDependencies": {
"babel-cli": "^6.26.0",
Expand Down
11 changes: 10 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ module.exports = {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
// Exclude node_modules as usual, with one exception:
// Compile graphql-relay with Babel, because we're not using the
// precompiled version published to npm (see `alias` below).
exclude: /node_modules(?!\/graphql-relay\/src)/,
use: {
loader: 'babel-loader',
options: {
Expand All @@ -24,6 +27,12 @@ module.exports = {
},
],
},
resolve: {
alias: {
// https://github.com/graphql/graphql-relay-js/issues/208
'graphql-relay$': 'graphql-relay/src/index.js',
},
},
output: {
path: __dirname + '/public',
publicPath: '/',
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2922,6 +2922,10 @@ graphql-relay@0.5.5:
version "0.5.5"
resolved "https://registry.yarnpkg.com/graphql-relay/-/graphql-relay-0.5.5.tgz#d6815e6edd618e878d5d921c13fc66033ec867e2"

graphql-relay@graphql/graphql-relay-js:
version "0.5.5"
resolved "https://codeload.github.com/graphql/graphql-relay-js/tar.gz/8055dfd534bc2c5f400ff4470974f74255f79c87"

graphql@0.13.2:
version "0.13.2"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.13.2.tgz#4c740ae3c222823e7004096f832e7b93b2108270"
Expand Down

0 comments on commit 6d94025

Please sign in to comment.