Support react-refresh and shared client/server types (#98)

- Adds support for react-refresh through `@pmmwh/react-refresh-webpack-plugin`. Updated webpack config to support this. Means entire app is no longer refreshed on changes, only individual components, and state is maintained.
- React refresh removes need for `google-apps-script-webpack-dev-server` package
- In client code, support for server function autocomplete through use of gas-client 1.0.0. Requires certain files to be typescript .ts files
- Remove need for "global" exports in main server file through updated gas-webpack-plugin
This commit is contained in:
Elisha Nuchi
2022-03-14 12:31:52 -04:00
committed by GitHub
parent 89c12fa161
commit 531a952df3
15 changed files with 1636 additions and 1402 deletions
+2 -7
View File
@@ -1,8 +1,6 @@
import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import server from '../src/client/utils/server';
const { serverFunctions } = server;
import { serverFunctions } from '../src/client/utils/serverFunctions.ts';
const { FILENAME, PORT } = process.env;
@@ -54,10 +52,7 @@ const DevServer = () => {
position: 'absolute',
}}
ref={iframe}
// The "/gas/" path here must match the path where the custom dev server is being loaded.
// See webpack.config.js "devServer" "before" settings.
// Filename extension "-impl" must match webpack.config.js clientConfigs filename settings for development.
src={`https://localhost:${PORT}/gas/${FILENAME}-impl.html`}
src={`https://localhost:${PORT}/${FILENAME}-impl.html`}
/>
</div>
);