Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not generate static routes #13762

Closed
TrungRueta opened this issue Apr 16, 2022 · 5 comments
Closed

Can not generate static routes #13762

TrungRueta opened this issue Apr 16, 2022 · 5 comments

Comments

@TrungRueta
Copy link

Environment


  • Operating System: Linux
  • Node Version: v16.14.2
  • Nuxt Version: 3.0.0-27501460.04a72f8
  • Package Manager: npm@8.5.0
  • Builder: vite
  • User Config: app, build, nitro, vite, experimental, typescript, features, globalName, cli, alias, components, autoImports, router, css, buildModules, privateRuntimeConfig, publicRuntimeConfig, generate, windicss, partytown
  • Runtime Modules: -
  • Build Modules: @vueuse/nuxt@8.2.6, nuxt-windicss@2.2.11, @nuxtjs/partytown@1.1.1, @unlighthouse/nuxt@0.3.21

Reproduction

follow latest version we can start generate static pages by config generate.routes in Nuxt.config.js.
commit

  • setup new nuxt with latest version , add new route to nuxt.config.js then try build.

Describe the bug

But for now when run build this error response:

ℹ Building server...                                                                                                                                 14:26:10
✔ Server built in 6292ms                                                                                                                             14:26:17
✔ Generated public .output/public                                                                                                              nitro 14:26:17
ℹ Prerendering routes                                                                                                                          nitro 14:26:17
  ⠙ Generating /helping-handls

 ERROR  [nuxt] [request error] Cannot find module '/workspace/.nuxt/prerender/chunks/app/core/core.js' imported from /workspace/.nuxt/prerender/chunks/app/server.mjs
  at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)  
  at new NodeError (node:internal/errors:371:5)  
  at finalizeResolution (node:internal/modules/esm/resolve:418:11)  
  at moduleResolve (node:internal/modules/esm/resolve:983:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1080:11)  
  at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)  
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)  
  at ModuleWrap.link (<anonymous>)  
  at link (node:internal/modules/esm/module_job:78:36)


<--- Last few GCs --->

[97766:0xffffb2a34340]    93766 ms: Mark-sweep (reduce) 2982.7 (3012.2) -> 2975.4 (3005.0) MB, 89.2 / 0.1 ms  (average mu = 0.155, current mu = 0.029) allocation failure scavenge might not succeed
[97766:0xffffb2a34340]    93892 ms: Mark-sweep (reduce) 2983.0 (3012.5) -> 2975.4 (3005.2) MB, 90.7 / 0.1 ms  (average mu = 0.224, current mu = 0.280) allocation failure scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
error Command failed with signal "SIGABRT".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.```

Sorry i going to move now so no time to create test project, but this issuehappend with fresh project too.

### Additional context

_No response_

### Logs

_No response_
@TrungRueta TrungRueta changed the title Can not generator static routes Can not generate static routes Apr 16, 2022
@danielroe
Copy link
Member

would you provide a reproduction? 🙏

@TrungRueta
Copy link
Author

@danielroe Here you go! https://stackblitz.com/edit/github-fjh4sx-m3hnpu?file=components%2Fdemo%2FDemoFirst.vue

  • after test a lot i found that if we setup fresh nuxt and no use any external package in page, then generate success, but when use a package which should only use in client side, it will failed by not found core.js file.

try project above with yarn build . in a component i add package swiper (making slide rotate). if remove component from main page it will work

@bootsmann1995
Copy link

@TrungRueta did you fix this?

@danielroe
Copy link
Member

I think you need to add swiper to you build.transpile array:

  import { defineNuxtConfig } from 'nuxt3';
  
  export default defineNuxtConfig({
    generate: {
      routes: ['/'],
    },
+   build: {
+     transpile: ['swiper'],
+   },
  });

@danielroe
Copy link
Member

I can no longer reproduce with latest nuxt + nitro.

@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants