nx-extensions
nx-extensions copied to clipboard
Stencil: `@nxext/stencil:build` fails if the `prerender` option is enabled in project.json
Describe the bug
Enabling the prerender
option in the target build makes the @nxext/stencil:build
fail.
To Reproduce
- Create an Nx workspace:
npx create-nx-workspace@latest myorg --preset=ts
- 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"
}
- Add
@nxext/stencil
:npm i -D @nxext/stencil
- Generate a Stencil library:
nx g @nxext/stencil:lib components --buildable --publishable
- 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
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 ^^'