vite/playground/hmr/hmrDep.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
343 B
JavaScript
Raw Permalink Normal View History

2020-12-23 04:07:57 +00:00
export const foo = 1
export { foo as nestedFoo } from './hmrNestedDep'
2020-12-11 01:39:52 +00:00
2020-12-14 04:06:11 +00:00
if (import.meta.hot) {
const data = import.meta.hot.data
if ('fromDispose' in data) {
console.log(`(dep) foo from dispose: ${data.fromDispose}`)
}
2020-12-11 05:09:06 +00:00
2020-12-14 04:06:11 +00:00
import.meta.hot.dispose((data) => {
console.log(`(dep) foo was: ${foo}`)
2020-12-23 04:07:57 +00:00
data.fromDispose = foo
2020-12-14 04:06:11 +00:00
})
}