stencil-router icon indicating copy to clipboard operation
stencil-router copied to clipboard

SSR broken when using router

Open andrewtennison opened this issue 6 years ago • 0 comments

Stencil version:

├─ @stencil/[email protected]
├─ @stencil/[email protected]
├─ @stencil/[email protected]
├─ @stencil/[email protected]
├─ @stencil/[email protected]
└─ @stencil/[email protected]

I'm submitting a ... [X ] bug report

Current behavior: When running stencil SSR without stencil-router it works as expected (eg the contents of a single page), when I try with the which contains the router it fails.

Steps to reproduce:

  1. pass in simple html string
    <!DOCTYPE html>
    <html dir="ltr" lang="en">

    <head>
      <meta charset="utf-8">
      <script src="/build/project.js"></script>
      <link href="/build/project.css" rel="stylesheet">
    </head>

    <body>
      <project-app-root></project-app-root>
    </body>

    </html>
  1. hydrate
renderer.hydrate({ html, req })
  1. hydrate returns original html, when when passed to the browser then hydrates as expected, but on the server it returns the following error
hydrate issue >>>>> fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '[..filePath..]/components/build/projectName/exports'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at NodeFs.readFileSync ([..filePath..]/node_modules/@stencil/core/dist/sys/node/index.js:866:19)
    at InMemoryFileSystem.readFileSync ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:672:39)
    at loadFile ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3792:39)
    at missingDependents.forEach.d ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3752:13)
    at Array.forEach (<anonymous>)
    at Object.loadBundle ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3750:27)
    at evalmachine.<anonymous>:29:10
    at ContextifyScript.Script.runInContext (vm.js:59:29)
    at Object.runInContext (vm.js:120:6)
    at Object.runInContext ([..filePath..]/node_modules/@stencil/core/dist/sys/node/index.js:614:8)
    at loadFile ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3793:23)
    at Object.requestBundle ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3786:17)
    at connectHostElement ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3094:13)
    at connectElement ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3076:13)
    at connectChildElements ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:3066:13)
    at resolve ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:5686:9)
    at new Promise (<anonymous>)
    at hydrateHtml ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:5585:12)
    at Renderer.<anonymous> ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:6801:40)
    at Generator.next (<anonymous>)
    at [..filePath..]/node_modules/@stencil/core/dist/server/index.js:6776:71
    at new Promise (<anonymous>)
    at __awaiter$e ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:6772:12)
    at Renderer.hydrate ([..filePath..]/node_modules/@stencil/core/dist/server/index.js:6797:16)
    at module.exports.hydrateComponents ([..filePath..]/.webpack/service/src/app.js:905:25)
    at [..filePath..]/.webpack/service/src/app.js:375:16

While it seems quite straight forward that there is a missing file, this file is nowhere in my build files and I cant find the original reference that is trying to load it, assuming this must be an internal to stencil/core.

andrewtennison avatar Oct 11 '18 17:10 andrewtennison