nx-extensions icon indicating copy to clipboard operation
nx-extensions copied to clipboard

Stencil: `@nxext/stencil:build` fails if the `prerender` option is enabled in project.json

Open dgonzalezr opened this issue 2 years ago • 1 comments

Describe the bug

Enabling the prerender option in the target build makes the @nxext/stencil:build fail.

image

To Reproduce

  1. Create an Nx workspace: npx create-nx-workspace@latest myorg --preset=ts
  2. Make sure to downgrade to Nx version 14.x since nxext/stencil is not yet compatible with Nx v15:
  "devDependencies": {
    "@nrwl/cli": "14.8.6",
    "@nrwl/js": "14.8.6",
    "@nrwl/workspace": "14.8.6",
    "nx": "14.8.6",
    "prettier": "^2.7.1",
    "typescript": "~4.8.4"
  }
  1. Add @nxext/stencil: npm i -D @nxext/stencil
  2. Generate a Stencil library: nx g @nxext/stencil:lib components --buildable --publishable
  3. Add the prerender option to the build target
"build": {
  "executor": "@nxext/stencil:build",
  "outputs": ["{options.outputPath}"],
  "options": {
    "projectType": "library",
    "tsConfig": "libs/components/tsconfig.lib.json",
    "configPath": "libs/components/stencil.config.ts",
    "outputPath": "dist/components",
    "prerender": true
  },
 ...

Expected behavior

The prerender option work as expected in the same way as you would do in a standalone Stencil library component within the --prerender CLI flag

dgonzalezr avatar Nov 04 '22 11:11 dgonzalezr

With prerender you need to set the url: baseUrl: ’https://.local/', for the www task

baseUrl: 'https://.local/',

Unfortunately the error you got is the generic error I get from the stencil compiler without the log entries ^^'

DominikPieper avatar Dec 02 '22 08:12 DominikPieper