-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Vite HMR #34
Comments
Okay, definitely an issue with the dune files/vite config in our project. HMR is working fine using https://github.com/pdelacroix/melange-vite-template |
Actually now it seems I can't get HMR to work w/ that template 🤔 |
It appears to be a problem with import { defineConfig } from "vite";
import melangePlugin from "vite-plugin-melange";
export default defineConfig({
plugins: [
melangePlugin({
emitDir: "src",
buildCommand: "opam exec -- dune build @react",
watchCommand: "opam exec -- dune build --watch @react",
}),
],
server: {
watch: {
usePolling: true,
/* awaitWriteFinish: {
stabilityThreshold: 500,
pollInterval: 20,
}, */
},
},
}); |
Configuring In the interim of completing #37 we're going to utilize
import { nodeResolve } from "@rollup/plugin-node-resolve";
export default {
build: {
outDir: "./dist",
},
plugins: [nodeResolve()],
};
{
"name": "app_name",
"version": "0.0.1",
"description": "Enter a description of your app here",
"scripts": {
"dev": "dune build && concurrently 'npm:vite-dev' 'npm:dune-watch'",
"vite-dev": "vite _build/default",
"dune-watch": "dune build -w",
"build": "dune build",
"bundle": "dune build && vite build",
"serve": "dune build && vite preview"
},
"dependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"concurrently": "^8.2.2",
"vite": "^4.5.0",
"vite-plugin-melange": "^2.2.0"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.tailwindcss.com"></script>
<title>create-melange-app</title>
</head>
<body>
<div id="root" class="flex h-screen w-screen flex-col items-center bg-gradient-to-b from-[#24273a] to-[#181926]">
<!-- This path is relative to the _build/default directory -->
<script type="module" src="./output/src/App.mjs"></script>
</body>
</html> |
Resolved by: 69d660f |
We use: https://github.com/pdelacroix/vite-plugin-melange
The text was updated successfully, but these errors were encountered: