Commit ed1a9450 authored by Joe Haddad's avatar Joe Haddad Committed by JJ Kasper

Disable SSG Transform on Non-SSG Pages (#9657)

* Disable SSG Transform on Non-SSG Pages

* correct test
parent 04b2f0eb
...@@ -137,6 +137,10 @@ export default function nextTransformSsg({ ...@@ -137,6 +137,10 @@ export default function nextTransformSsg({
state.done = false state.done = false
}, },
exit(path, state) { exit(path, state) {
if (!state.isPrerender) {
return
}
const refs = state.refs const refs = state.refs
let count: number let count: number
...@@ -213,9 +217,7 @@ export default function nextTransformSsg({ ...@@ -213,9 +217,7 @@ export default function nextTransformSsg({
}) })
} while (count) } while (count)
if (state.isPrerender) { decorateSsgExport(t, path, state)
decorateSsgExport(t, path, state)
}
}, },
}, },
VariableDeclarator(path, state) { VariableDeclarator(path, state) {
......
...@@ -323,6 +323,8 @@ describe('babel plugin (next-ssg-transform)', () => { ...@@ -323,6 +323,8 @@ describe('babel plugin (next-ssg-transform)', () => {
var bug = 1; var bug = 1;
return { bug }; return { bug };
} }
export { unstable_getStaticProps } from 'a'
`) `)
expect(output).toMatchInlineSnapshot( expect(output).toMatchInlineSnapshot(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment