Skip to content

Commit

Permalink
Merge pull request #222 from briangleeson/fixDEVConflict
Browse files Browse the repository at this point in the history
fix: __DEV__ build conflict (fix #221)
  • Loading branch information
frandiox authored Aug 13, 2024
2 parents 50461a4 + eec62ff commit 63498e2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export = function ViteSsrPlugin(
__CONTAINER_ID__: JSON.stringify(options.containerId || 'app'),
// Vite 2.6.0 bug: use this
// instead of import.meta.env.DEV
__DEV__: env.mode !== 'production',
__VITE_SSR_DEV__: env.mode !== 'production',
},
ssr: {
...detectedFeats.ssr,
Expand Down
2 changes: 1 addition & 1 deletion src/react/entry-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const viteSSR: ClientHandler = async function (
styles && styles.cleanup && styles.cleanup()

// @ts-ignore
__DEV__ ? ReactDOM.render(app, el) : ReactDOM.hydrate(app, el)
__VITE_SSR_DEV__ ? ReactDOM.render(app, el) : ReactDOM.hydrate(app, el)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function buildHtmlDocument(
{ htmlAttrs, bodyAttrs, headTags, body, initialState }: DocParts
) {
// @ts-ignore
if (__DEV__) {
if (__VITE_SSR_DEV__) {
if (template.indexOf(`id="${containerId}"`) === -1) {
console.warn(
`[SSR] Container with id "${containerId}" was not found in index.html`
Expand Down
2 changes: 1 addition & 1 deletion test/setup/globals.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const globals = {
__DEV__: false,
__VITE_SSR_DEV__: false,
__CONTAINER_ID__: 'app',
}

Expand Down

0 comments on commit 63498e2

Please sign in to comment.