question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use import.meta.hot in a vitepress plugin

See original GitHub issue

Describe the bug

Trying to implement client server communication in a vite-plugin I’m receiving Property ‘hot’ does not exist on type ‘ImportMeta’ just like in #416.

Try to import vite/hmr but it is not exported but importing vite/client fix it (at least volar and build stop complaining…)

but when I run client I got an error in the import line

https://github.com/emersonbottero/vitepress-plugin-search/blob/flexsearch/src/Search.vue#L4

GET http://localhost:5173/@fs/C:/Users/emers/Source/Repos/vitepress-plugin-search/dist/Search.vue net::ERR_ABORTED 500 (Internal Server Error)

P.S.: I’m trying to improve the vitepress-plugin-search so it is easy to provide options to the builder and search. in the current version is hard to add languages for example

Reproduction

press . on my repository within the browser 😁

Steps to reproduce

pnpm i pnpm build cd demo pnpm i pnpm dev

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
    Memory: 6.20 GB / 15.92 GB
  Binaries:    Node: 16.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - ~\AppData\Roaming\npm\yarn.CMD    npm: 8.1.3 - ~\AppData\Roaming\npm\npm.CMD
  Browsers:
    Chrome: 106.0.5249.119
    Edge: Spartan (44.22621.746.0), Chromium (106.0.1370.42)
    Internet Explorer: 11.0.22621.1

Used Package Manager

pnpm

Logs

No response

Validations

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bluwycommented, Dec 24, 2022

I don’t think so. Feel free to take it!

0reactions
pratik-codescommented, Dec 24, 2022

is anyone working on this ? @emersonbottero @bluwy

Read more comments on GitHub >

github_iconTop Results From Across the Web

HMR API - Vite
The import.meta.hot.data object is persisted across different instances of the same updated module. It can be used to pass on information from a...
Read more >
vitepress/plugin.ts at main - GitHub
import path from 'path'. import c from 'picocolors'. import {. defineConfig,. mergeConfig,. searchForWorkspaceRoot,. Plugin,. ResolvedConfig. } from 'vite'.
Read more >
Development | Guide - Vite PWA - Netlify
You must not use HMR (Hot Module Replacement) in your custom service worker, since we cannot use yet dynamic imports in service workers:...
Read more >
CHANGELOG.md · LEARN/vite - Gitee.com
import.meta.hot.acceptDeps() is now used for accepting dependency updates without re-instantiating acceptor. import.meta.hot.data is an object that is persisted ...
Read more >
Retour Craft CMS Plugin | Changelog - nystudio107
... alias that resolves to the actual directory; Add import.meta.hot.accept for entrypoint JavaScript for HMR; Updated docs to use VitePress ^1.0.0-alpha.29 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found