scullyio / scully

The Static Site Generator for Angular apps
https://scully.io/
MIT License
2.55k stars 257 forks source link

Cannot find module "...\scully\runtime\app.sps.module.js" #1586

Open ronaldogmartins opened 2 years ago

ronaldogmartins commented 2 years ago

🐞 Bug report

Description

Ionic / Angular project Build ok (ionic cordova build browser or ionic build). When running "npx scully" the above error occurs. Note that the ts file was created in the ./src/app directory, but the error indicates that the js file does not exist in the /runtime directory and not in /runtime/app.

πŸ”¬ Minimal Reproduction

scully.app.config.ts: import { enableSPS, ScullyConfig } from '@scullyio/scully'; import { cpus } from 'os'; enableSPS(); export const config: ScullyConfig = { projectName: "app", spsModulePath: './src/app/app.sps.module.ts', outDir: './dist/static', maxRenderThreads: cpus().length * 3, routes: { } };

Created file ./src/app/app.sps.module.ts as in documentation: enableProdMode(); @NgModule({ imports: [ BrowserModule.withServerTransition({ appId: 'serverApp' }), AppModule, ScullyPlatformServerModule, IonicServerModule, ], providers: [], bootstrap: [AppComponent], }) export default class AppSPSModule {}

πŸ’»Your Environment

Windows Angular Version: 12.2.16 "@ionic/angular": "^5.6.14"





πŸ”₯ Exception or Error

npx scully βœ” Folder "./scully" used for custom plugins βœ” new Angular build files imported βœ” Starting servers for project "app" βœ” Started Angular distribution server on "http://localhost:1864/" βœ” Started Scully static server on "http://localhost:1668/" βœ” Scully Development Server is up and running βœ” Angular application compiled successfully Unhandled Promise rejection: Cannot find module 'C:\Apps\PasseioJa_1_0\PasseioJaApp\scully\runtime\app.sps.module.js' Require stack:



  x Could not load angular app: Error: Cannot find module '.\scully\runtime\app.sps.module.js'
Require stack:
- C:\Apps\PasseioJa_1_0\PasseioJaApp\node_modules\@scullyio\scully\src\lib\utils\platform-server\ps-worker.js       
  x Could not load angular app: Error: Cannot find module '.\scully\runtime\app.sps.module.js'
Require stack:
- C:\Apps\PasseioJa_1_0\PasseioJaApp\node_modules\@scullyio\scully\src\lib\utils\platform-server\ps-worker.js       
  x Could not load angular app: Error: Cannot find module '.\scully\runtime\app.sps.module.js'
Require stack:
- C:\Apps\PasseioJa_1_0\PasseioJaApp\node_modules\@scullyio\scully\src\lib\utils\platform-server\ps-worker.js       
  βœ” 12 workers are ready to go
  ⚠ ----------------------------------
  ⚠ Using stored unhandled routes!.
  ⚠    To discover new routes in the angular app use "npm run scully -- --scanRoutes"
  ⚠ ----------------------------------
  βœ” Successfully added routes created from routePlugins
  βœ” Route list created in files:
     ".\src\assets\scully-routes.json",
     "C:\Apps\PasseioJa_1_0\PasseioJaApp\dist\static\assets\scully-routes.json",
     "C:\Apps\PasseioJa_1_0\PasseioJaApp\www\assets\scully-routes.json"

  x Plugin "spsRenderRunner" of type "undefined" is not found, can not store config
  x  The scullySystem plugin "SPSRenderer has thrown the below error,
              while trying to render route "unknown"
              Scully will exit
  x undefined


ronaldogmartins commented 2 years ago

Hi @SanderElias, good afternoon! Please let me know if I have registered this issue in the right place and in the right way as I have no experience asking for help with using tools directly here. Do you believe that I may have gone wrong in some configuration? Or will you try to identify what happened? In this case, do I need to provide any more details? Other info: does scully work with Ionic or just Angular? Thanks,

SanderElias commented 2 years ago

@ronaldogmartins Well, its explained in the (way to basic) docs page

In short, The platform-server-renderer isn't really ready for prime time but might work well for you. As you have an ionic app, that uses web components, rendering it with default Scully will not yet work well. (We have a longstanding issue for this, but found no time to work on it yet) If you use our SPS render, and follow the Ionic instructions for Universal, it probably will work pretty well, but there is no support just yet.

I will accept sponsoring to prioritize any of those issues!