Stencil.js error when running the “build” script: TypeError: Cannot read property ‘toString’ of undefined at e.getRenderedHash [Solved]

If you are getting this error when running yarn build or npm run build that is probably because the versions of both the stencil core and stencil router are outdated.

For solving this issue, just update both dependencies:

yarn add @stencil/core@next
yarn add @stencil/router --dev

Here are my current dependencies, just for reference:

{
    "dependencies":
    {
        "@stencil/core": "^0.18.1",
    },
    "devDependencies":
    {
        "@stencil/router": "^0.3.3",
        "workbox-build": "3.4.1"
    }
}

If you are interested in knowing more about this issue, please refer to: https://github.com/ionic-team/stencil-router/issues/86 and https://github.com/ionic-team/stencil-app-starter/issues/64.

That’s it, from now on your build should work as expected.

Leave a Reply

Your email address will not be published. Required fields are marked *