diff --git a/lib/hmr.ts b/lib/hmr.ts index 3fcfb6a..91a1c17 100644 --- a/lib/hmr.ts +++ b/lib/hmr.ts @@ -52,6 +52,10 @@ export function hmr() { if (resourcePath.includes('/-components/')) { return source; } + const name = require(`${process.cwd()}/package.json`).name; + if (resourcePath.includes(`/assets/${name}.js`)) { + source += `\nimport.meta.hot.accept();`; + } if ( resourcePath.endsWith('.hbs') || resourcePath.endsWith('.gjs') || diff --git a/package.json b/package.json index ae7dcd7..cb9c2f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-vite-hmr", - "version": "0.6.4", + "version": "0.6.5", "keywords": [ "ember-addon" ],