antfu-collective / vite-ssg

Static site generation for Vue 3 on Vite
MIT License
1.27k stars 129 forks source link

document.documentElement.setAttribute is not a function #406

Open rezelute opened 2 weeks ago

rezelute commented 2 weeks ago

Describe the bug

On vite-ssg version: 0.23.0 (and onwards) with critters 0.0.20, ive started getting the following error when trying to build ...

file:///.../node_modules/vite-ssg/dist/node.mjs:1058
        throw new Error(`${gray("[vite-ssg]")} ${red(`Error on page: ${cyan(route)}`)}
              ^

Error: [vite-ssg] Error on page: /
TypeError: document.documentElement.setAttribute is not a function
    at createDocument (file:///.../node_modules/critters/dist/critters.mjs:519:30)
    at Critters.process (file:///.../node_modules/critters/dist/critters.mjs:1123:22)
    at file:///.../node_modules/vite-ssg/dist/node.mjs:1048:40    
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///.../node_modules/vite-ssg/dist/node.mjs:707:36
    at file:///.../node_modules/vite-ssg/dist/node.mjs:1058:15    
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async file:///.../node_modules/vite-ssg/dist/node.mjs:707:36

Node.js v20.14.0
node:child_process:965
    throw err;
    ^

Error: Command failed: vue-tsc --noEmit && vite-ssg build
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at Object.execSync (node:child_process:962:15)
    at Object.<anonymous> (C:\...\npm-build.js:17:26)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 82856,
  stdout: null,
  stderr: null
}

Node.js v20.14.0

Reproduction

Use vite ssg 0.23.0 with critters 0.0.20

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 11.25 GB / 31.92 GB
  Binaries:
    Node: 20.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (126.0.2592.61)

Used Package Manager

npm

Validations

Contributions