Skip to content

Commit

Permalink
migrated to snowpack from create-react-app
Browse files Browse the repository at this point in the history
  • Loading branch information
anselm94 committed Apr 17, 2021
1 parent c03e1d7 commit f312370
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 142 deletions.
12 changes: 6 additions & 6 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"axios-hooks": "^1.9.0",
"graphql": "^14.6.0",
"graphql-tag": "^2.10.3",
"http-proxy": "^1.18.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "latest",
"react-scripts": "latest",
"react-helmet": "^6.1.0",
"snowpack": "^3.3.3",
"subscriptions-transport-ws": "^0.9.16",
"urql": "^1.9.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "snowpack dev",
"build": "snowpack build",
"test": "echo \"No tests to run :(\" && exit 1"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
1 change: 1 addition & 0 deletions web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/dist/index.js"></script>
</body>

</html>
43 changes: 43 additions & 0 deletions web/snowpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/** @type {import("snowpack").SnowpackUserConfig } */

const httpProxy = require("http-proxy");
const proxy = httpProxy.createServer({ target: "http://localhost:3000" });

module.exports = {
env: {
REACT_APP_WEBSOCKET_ENDPOINT: "ws://localhost:8080/query",
},
mount: {
public: "/",
src: "/dist",
},
plugins: [
/* ... */
],
routes: [
{
src: "/query.*",
dest: (req, res) => {
proxy.web(req, res);
},
upgrade: (req, socket, head) => {
proxy.ws(req, socket);
},
},
/* Enable an SPA Fallback in development: */
{ match: "routes", src: ".*", dest: "/index.html" },
],
optimize: {
/* Example: Bundle your final build: */
// "bundle": true,
},
packageOptions: {
/* ... */
},
devOptions: {
/* ... */
},
buildOptions: {
/* ... */
},
};
2 changes: 1 addition & 1 deletion web/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Provider as UrqlProvider, createClient, defaultExchanges, subscriptionE
import { SubscriptionClient } from 'subscriptions-transport-ws';

const subscriptionClient = new SubscriptionClient(
process.env.REACT_APP_WEBSOCKET_ENDPOINT,
import.meta.env.REACT_APP_WEBSOCKET_ENDPOINT,
{}
);
const gqlclient = createClient({
Expand Down
135 changes: 0 additions & 135 deletions web/src/serviceWorker.js

This file was deleted.

0 comments on commit f312370

Please sign in to comment.