[๐] SSG in fresh project not working
wtho opened this issue ยท 2 comments
wtho commented
Which component is affected?
Qwik Rollup / Vite plugin
Describe the bug
When running SSG on a fresh qwik project, I immediately run into errors:
$ npm run build.server
โ 34 modules transformed.
server/build/q-YWg4fP5u.css 3.68 kB
server/entry.ssr.js 18.62 kB
server/@qwik-city-plan.js 21.16 kB
server/q-SuYaUqWW.js 84.01 kB
โ built in 6.25s
Starting Qwik City SSG...
Missing client manifest, loading symbols in the client might 404. Please ensure the client build has run and generated the manifest for the server build.
Then three errors occur:
Error during SSG
Oe is not iterable (cannot read property Symbol(Symbol.iterator))
Pathname: /
Plugin: qwik-ssg
File: /workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17552
[...]
13 | This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route.
at V$ (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17552)
at AsyncFunction.J$ (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17985)
at AsyncFunction.Mi (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:10:5865)
at AsyncFunction.B (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:10:5799)
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:10530
at R (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:7:1604)
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:10399
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:8:4723
at De (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:7:1524)
at we (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:8:4716)
dist/index.html
Missing client manifest, loading symbols in the client might 404. Please ensure the client build has run and generated the manifest for the server build.
Missing client manifest, loading symbols in the client might 404. Please ensure the client build has run and generated the manifest for the server build.
Error during SSG
Oe is not iterable (cannot read property Symbol(Symbol.iterator))
Pathname: /demo/flower/
Plugin: qwik-ssg
File: /workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17552
[...]
12 | Action.run() can only be called on the browser, for example when a user clicks a button, or submits a form.`)},Al=(t,...e)=>{const{id:n,validators:s}=ir(e,t);function o(){const r=sl(),i=rl(),c={actionPath:`?${X$}=${n}`,isRunning:!1,status:void 0,value:void 0,formData:void 0},$=jt(()=>{const a=i.value;if(a&&(a==null?void 0:a.id)===n){const f=a.data;if(f instanceof FormData&&(c.formData=f),a.output){const{status:p,result:m}=a.output;c.status=p,c.value=m}}return c}),l=lt(ul,"s_A5bZC7WO00A",[i,n,r,$]);return c.submit=l,$}return o.__brand="server_action",o.__validators=s,o.__qrl=t,o.__id=n,Object.freeze(o),o},ql=(t,...e)=>{const{id:n,validators:s}=ir(e,t);function o(){return Jt(jo,r=>{if(!(n in r))throw new Error(`routeLoader$ "${t.getSymbol()}" was invoked in a route where it was not declared.
13 | This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route.
at V$ (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17552)
at AsyncFunction.J$ (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17985)
at AsyncFunction.Mi (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:10:5865)
at AsyncFunction.B (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:10:5799)
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:10530
at R (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:7:1604)
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:10399
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:8:4723
at De (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:7:1524)
at we (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:8:4716)
dist/demo/flower/index.html
Error during SSG
Oe is not iterable (cannot read property Symbol(Symbol.iterator))
Pathname: /demo/todolist/
Plugin: qwik-ssg
File: /workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17552
[...]
12 | Action.run() can only be called on the browser, for example when a user clicks a button, or submits a form.`)},Al=(t,...e)=>{const{id:n,validators:s}=ir(e,t);function o(){const r=sl(),i=rl(),c={actionPath:`?${X$}=${n}`,isRunning:!1,status:void 0,value:void 0,formData:void 0},$=jt(()=>{const a=i.value;if(a&&(a==null?void 0:a.id)===n){const f=a.data;if(f instanceof FormData&&(c.formData=f),a.output){const{status:p,result:m}=a.output;c.status=p,c.value=m}}return c}),l=lt(ul,"s_A5bZC7WO00A",[i,n,r,$]);return c.submit=l,$}return o.__brand="server_action",o.__validators=s,o.__qrl=t,o.__id=n,Object.freeze(o),o},ql=(t,...e)=>{const{id:n,validators:s}=ir(e,t);function o(){return Jt(jo,r=>{if(!(n in r))throw new Error(`routeLoader$ "${t.getSymbol()}" was invoked in a route where it was not declared.
13 | This is because the routeLoader$ was not exported in a 'layout.tsx' or 'index.tsx' file of the existing route.
at V$ (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17552)
at AsyncFunction.J$ (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:17985)
at AsyncFunction.Mi (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:10:5865)
at AsyncFunction.B (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:10:5799)
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:10530
at R (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:7:1604)
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:11:10399
at file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:8:4723
at De (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:7:1524)
at we (file:///workspaces/qwik-ssg-test/server/q-SuYaUqWW.js:8:4716)
dist/demo/todolist/index.html
error during build:
undefined
If done the same steps with selecting Empty Project
, only the third error will occur.
Reproduction
https://github.com/wtho/qwik-ssg-test
Steps to reproduce
- Create fresh qwik project
$ npm create qwik@latest
> Where would you like to create your new project?
./
> Select a starter
Basic App (Qwik City + Qwik)
> Would you like to install npm dependencies?
Yes
- Add SSG as described in docs
$ npm run qwik add static
> Ready to apply the static updates to your app?
Yes looks good, finish update!
- Run the build and the errors will come in
$ npm run build.server
System Info
Used codespaces. `npx envinfo` output:
System:
OS: Linux 6.2 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (2) x64 AMD EPYC 7763 64-Core Processor
Memory: 5.98 GB / 7.74 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 20.12.1 - ~/nvm/current/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 10.5.0 - ~/nvm/current/bin/npm
pnpm: 8.15.6 - ~/nvm/current/bin/pnpm
npmPackages:
@builder.io/qwik: ^1.5.2 => 1.5.2
@builder.io/qwik-city: ^1.5.2 => 1.5.2
undici: * => 6.13.0
vite: ^5.1.6 => 5.2.8
### Additional Information
_No response_
wmertens commented
Like the error says, you need to run npm run build.client
first or just run build which does both.