Use a Snowpack plugin to enable React Fast Refresh (#845)

This commit is contained in:
Jon Koops 2021-07-14 14:17:57 +02:00 committed by GitHub
parent ca03bb4cc9
commit eaeebdc242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 2 deletions

1
package-lock.json generated
View file

@ -32,6 +32,7 @@
"@jest/types": "^27.0.6",
"@snowpack/app-scripts-react": "^1.12.6",
"@snowpack/plugin-postcss": "1.4.3",
"@snowpack/plugin-react-refresh": "^2.5.0",
"@snowpack/plugin-typescript": "^1.2.1",
"@snowpack/plugin-webpack": "3.0.0",
"@storybook/addon-actions": "^6.3.4",

View file

@ -48,6 +48,7 @@
"@jest/types": "^27.0.6",
"@snowpack/app-scripts-react": "^1.12.6",
"@snowpack/plugin-postcss": "1.4.3",
"@snowpack/plugin-react-refresh": "^2.5.0",
"@snowpack/plugin-typescript": "^1.2.1",
"@snowpack/plugin-webpack": "3.0.0",
"@storybook/addon-actions": "^6.3.4",

View file

@ -3,7 +3,11 @@ module.exports = {
proxy: {
"/auth/admin": "http://localhost:8180/auth/admin/",
},
plugins: ["@snowpack/plugin-postcss", "@snowpack/plugin-typescript"],
plugins: [
"@snowpack/plugin-postcss",
"@snowpack/plugin-react-refresh",
"@snowpack/plugin-typescript",
],
buildOptions: {
baseUrl: "/adminv2",
clean: true,

View file

@ -13,3 +13,9 @@ init().then((adminClient) => {
document.getElementById("app")
);
});
// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
// Learn more: https://snowpack.dev/concepts/hot-module-replacement
if (import.meta.hot) {
import.meta.hot.accept();
}

View file

@ -1,7 +1,7 @@
{
"extends": "@snowpack/app-scripts-react/tsconfig.base.json",
"compilerOptions": {
"types": ["jest", "cypress"],
"types": ["jest", "cypress", "snowpack-env"],
"esModuleInterop": true
}
}