vite: module.hot regression

Describe the bug

When using the self-accepting API it transforms

main.jsx
...someCode

          if (__DEV__) {
            hot.accept((m) => {
              try {
                for (let i in m) {
                  compareSignatures(module[i], m[i]);
                }
              } catch (e) {
                window.location.reload();
              }
            });
          }

TO:

            hot.accept("/main.jsx", "/main.jsx", m => {
              try {
                for (let i in m) {
                  compareSignatures(module[i], m[i]);
                }
              } catch (e) {
                window.location.reload();
              }
            });

The self-accepted url gets injected twice meaning the callback never gets called, this feels like a problem in the transform-step. Maybe this is intended as an array (?) it is the sam string twice though.

Reproduction

bug

System Info

  • required vite version: 0.16
  • required Operating System: Windows 10
  • required Node version: 12.13

Logs (Optional if provided reproduction)

vite v0.16.0
  vite:config config resolved in 68ms +0ms
  vite:optimize Hash is consistent. Skipping. Use --force to override. +0ms

  Dev server running at:
  > Network:  http://192.168.1.6:3000/
  > Local:    http://localhost:3000/

  vite:server server ready in 382ms. +0ms

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (22 by maintainers)

Most upvoted comments

There are some other fixes required to get it working which isn’t released yet. Stay tuned!