Skip to content

Commit 6d94025

Browse files
committed
fix: use graphql-relay-js from GitHub
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
1 parent 924edf4 commit 6d94025

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"express": "^4.16.3",
4848
"express-graphql": "^0.6.12",
4949
"graphql": "0.13.2",
50-
"graphql-relay": "0.5.5"
50+
"graphql-relay": "graphql/graphql-relay-js"
5151
},
5252
"devDependencies": {
5353
"babel-cli": "^6.26.0",

webpack.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ module.exports = {
77
rules: [
88
{
99
test: /\.js$/,
10-
exclude: /node_modules/,
10+
// Exclude node_modules as usual, with one exception:
11+
// Compile graphql-relay with Babel, because we're not using the
12+
// precompiled version published to npm (see `alias` below).
13+
exclude: /node_modules(?!\/graphql-relay\/src)/,
1114
use: {
1215
loader: 'babel-loader',
1316
options: {
@@ -24,6 +27,12 @@ module.exports = {
2427
},
2528
],
2629
},
30+
resolve: {
31+
alias: {
32+
// https://github.com/graphql/graphql-relay-js/issues/208
33+
'graphql-relay$': 'graphql-relay/src/index.js',
34+
},
35+
},
2736
output: {
2837
path: __dirname + '/public',
2938
publicPath: '/',

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,6 +2922,10 @@ [email protected]:
29222922
version "0.5.5"
29232923
resolved "https://registry.yarnpkg.com/graphql-relay/-/graphql-relay-0.5.5.tgz#d6815e6edd618e878d5d921c13fc66033ec867e2"
29242924

2925+
graphql-relay@graphql/graphql-relay-js:
2926+
version "0.5.5"
2927+
resolved "https://codeload.github.com/graphql/graphql-relay-js/tar.gz/8055dfd534bc2c5f400ff4470974f74255f79c87"
2928+
29252929
29262930
version "0.13.2"
29272931
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.13.2.tgz#4c740ae3c222823e7004096f832e7b93b2108270"

0 commit comments

Comments
 (0)