Skip to content

Commit

Permalink
refresh webpack example and fix dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Mar 24, 2023
1 parent 43b7473 commit 5077414
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 261 deletions.
9 changes: 5 additions & 4 deletions example/webpack-example/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import * as ReactDOMClient from 'react-dom/client';

import { Voyager } from 'graphql-voyager';
import fetch from 'isomorphic-fetch';

class Test extends React.Component {
constructor() {
Expand All @@ -18,15 +17,17 @@ class Test extends React.Component {
);
}

introspectionProvider(query) {
return fetch('http://swapi.apis.guru', {
async introspectionProvider(query) {
const response = await fetch('https://swapi-graphql.netlify.app/.netlify/functions/index', {
method: 'post',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({ query }),
}).then((response) => response.json());
credentials: 'omit',
});
return response.json();
}
}

Expand Down
16 changes: 9 additions & 7 deletions example/webpack-example/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{
"private": "true",
"description": "An example using GraphQL-Voyager",
"scripts": {
"start": "webpack-dev-server --config webpack.config.js"
"start": "webpack-dev-server --config webpack.config.js --mode=development"
},
"dependencies": {
"graphql": "14.2.1",
"graphql-voyager": "../../",
"react": "16.8.6",
"react-dom": "16.8.6"
"graphql": "16.5.0",
"graphql-voyager": "file:../../graphql-voyager-1.0.0.tgz",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@babel/core": "7.4.3",
"@babel/preset-env": "7.4.3",
"@babel/preset-react": "7.0.0",
"babel-loader": "8.0.5",
"webpack": "4.30.0",
"webpack-dev-server": "3.3.1"
"webpack": "5.73.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.9.1"
}
}
13 changes: 6 additions & 7 deletions example/webpack-example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ module.exports = {
hints: false,
},
devServer: {
contentBase: __dirname,
watchContentBase: true,
https: true,
port: 9090,
stats: 'errors-only',
static: {
directory: __dirname,
},
liveReload: true,
},
stats: 'errors-only',
resolve: {
extensions: ['.ts', '.tsx', '.mjs', '.js', '.json', '.css', '.svg'],
alias: {
// fix "duplicated react" issue when using npm link
react: require.resolve('react'),
},
},
entry: ['./index.jsx'],
output: {
Expand Down
Loading

0 comments on commit 5077414

Please sign in to comment.