Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
feat: add webpack support
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 15, 2022
1 parent 823e4f8 commit f7f0a95
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/nuxt/src/pages/page-meta.ts
Expand Up @@ -19,10 +19,19 @@ export default __nuxt_page_meta
`

const CODE_HMR = `
if (import.meta.hot) {
import.meta.hot.accept(mod => {
Object.assign(__nuxt_page_meta, mod)
})
if (process.dev) {
// Vite
if (import.meta.hot) {
import.meta.hot.accept(mod => {
Object.assign(__nuxt_page_meta, mod)
})
}
// Webpack
if (import.meta.webpackHot) {
import.meta.webpackHot.accept((err) => {
if (err) { window.location = window.location.href }
})
}
}`

export const PageMetaPlugin = createUnplugin((options: PageMetaPluginOptions) => {
Expand Down

0 comments on commit f7f0a95

Please sign in to comment.