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

[BUG]: prerender routes causes build error on Windows #270

Closed
2 tasks
AdditionAddict opened this issue Feb 18, 2023 · 0 comments · Fixed by #275
Closed
2 tasks

[BUG]: prerender routes causes build error on Windows #270

AdditionAddict opened this issue Feb 18, 2023 · 0 comments · Fixed by #275
Labels
bug Something isn't working

Comments

@AdditionAddict
Copy link
Contributor

AdditionAddict commented Feb 18, 2023

Please provide the environment you discovered this bug in.

https://github.com/AdditionAddict/build-error-for-analogjs-prerender

/dist folder added to show build

Which area/package is the issue in?

platform

Description

Including prerender routes causes windows build error:

An unhandled exception occurred: Only URLs with a scheme in: file, data are supported by the default ESM loader. 
On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

vite.config.ts

  plugins: [analog({
    ssr: true,
    static: true,
    prerender: {
      routes: async () => ['/', '/about']
    }
  })],

Further dist/server/public/about/index.html is not created running npm run build

Same issue for similar config, without async and using nitro config:

  plugins: [analog({
    ssr: true,
    static: true,
    nitro: {
      prerender: {
        routes: ['/', '/about']
      }
    }
  })],

Please provide the exception or error you saw

C:\Users\andrewa\Documents\ProofOfConceptApps\Analog\build-error>npm run build      

> build-error@0.0.0 build
> ng build

vite v4.1.2 building for production...
✓ 248 modules transformed.
dist/client/index.html                   1.71 kB
dist/client/assets/index-a4a5e83c.css    0.97 kB │ gzip:  0.53 kB
dist/client/assets/about-ef3e99f4.js     0.43 kB │ gzip:  0.33 kB
dist/client/assets/index-6a7c4395.js     0.44 kB │ gzip:  0.33 kB
dist/client/assets/index-0b9d3872.js   218.38 kB │ gzip: 68.33 kB
Building SSR application...
vite v4.1.2 building SSR bundle for production...
✓ 23 modules transformed.
dist/ssr/assets/index-e14c2f6d.mjs    1.18 kB
dist/ssr/assets/about-d8d8d57b.mjs    1.19 kB
dist/ssr/main.server.mjs            788.34 kB
Building Server...
Prerendering static pages...
'C:UsersandrewaDocumentsProofOfConceptAppsAnalouild-error
ode_modules@analogjsplatformsrclib/runtime/renderer' is imported by virtual:#internal/nitro/virtual/server-handlers, but could not be resolved – treating it as an external dependency
'C:UsersandrewaDocumentsProofOfConceptAppsAnalouild-error
ode_modules@analogjsplatformsrclib/runtime/api-middleware' is imported by virtual:#internal/nitro/virtual/server-handlers, but could not be resolved – treating it as an external dependency
An unhandled exception occurred: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
See "C:\Users\andrewa\AppData\Local\Temp\ng-bF97Jn\angular-errors.log" for further details.

angular-errors.log

[error] Error: Only URLs with a scheme in: file, data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
    at new NodeError (node:internal/errors:387:5)
    at throwIfUnsupportedURLScheme (node:internal/modules/esm/resolve:1116:11)
    at defaultResolve (node:internal/modules/esm/resolve:1196:3)
    at nextResolve (node:internal/modules/esm/loader:165:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:844:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:431:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36)

Other information

>node --version
v16.17.1

Windows 10 Pro
x64-based PC

I would be willing to submit a PR to fix this issue

  • Yes
  • No
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant