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

Stencil: build doesn't work on nx 15.9.x

Open marcincichocki opened this issue 3 years ago • 17 comments

Describe the bug @nxext/stencil:build does not work after update to nx 15.9.x. Error message is shown:

Cannot find module '@nrwl/workspace/src/utilities/ast-utils'

To Reproduce Try to build project with latest nx

Expected behavior Executor should work as before.

Additional context Looks like this file: https://github.com/nxext/nx-extensions/blob/main/packages/stencil/src/utils/ast-utils.ts#L4 is importing file that does not exist anymore. It was moved: https://github.com/nrwl/nx/pull/15540/files#diff-6a3ae3fda9f50d1b43708469ef9af795224222b10b7b4802b561da5529d6db12

marcincichocki avatar Apr 06 '23 10:04 marcincichocki

I have same problem! :/

oscarcornejo avatar Apr 13 '23 20:04 oscarcornejo

I get the same thing. Brand new (package-based) NX repo. And the first thing I'm trying to do is add a stencil library and I get this error! I'm running @nxext/stencil:lib

MrGrigri avatar Apr 14 '23 17:04 MrGrigri

same issue here

naeimsf avatar Apr 16 '23 11:04 naeimsf

Today I have upgraded nx and I am facing the same issue.

erichstark avatar Apr 18 '23 11:04 erichstark

@marcincichocki what version were these commands working with?

MrGrigri avatar Apr 18 '23 15:04 MrGrigri

@MrGrigri Sorry I forgot to mention this in my post. This is an output of yarn info nx @nxext/stencil. It's working just fine with these versions.

Toggle
yarn info nx @nxext/stencil
├─ @nxext/stencil@npm:15.7.0
│  ├─ Instances: 1
│  ├─ Version: 15.7.0
│  │
│  └─ Dependencies
│     ├─ @nrwl/devkit@npm:~15.7.0 → npm:15.7.2
│     └─ ignore@npm:^5.2.0 → npm:5.2.0
│
└─ nx@npm:15.8.5
   ├─ Instances: 1
   ├─ Version: 15.8.5
   │
   ├─ Exported Binaries
   │  └─ nx
   │
   └─ Dependencies
      ├─ @nrwl/cli@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-darwin-arm64@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-darwin-x64@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-linux-arm-gnueabihf@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-linux-arm64-gnu@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-linux-arm64-musl@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-linux-x64-gnu@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-linux-x64-musl@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-win32-arm64-msvc@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/nx-win32-x64-msvc@npm:15.8.5 → npm:15.8.5
      ├─ @nrwl/tao@npm:15.8.5 → npm:15.8.5
      ├─ @parcel/watcher@npm:2.0.4 → npm:2.0.4
      ├─ @yarnpkg/lockfile@npm:^1.1.0 → npm:1.1.0
      ├─ @yarnpkg/parsers@npm:^3.0.0-rc.18 → npm:3.0.0-rc.20
      ├─ @zkochan/js-yaml@npm:0.0.6 → npm:0.0.6
      ├─ axios@npm:^1.0.0 → npm:1.3.3
      ├─ chalk@npm:^4.1.0 → npm:4.1.2
      ├─ cli-cursor@npm:3.1.0 → npm:3.1.0
      ├─ cli-spinners@npm:2.6.1 → npm:2.6.1
      ├─ cliui@npm:^7.0.2 → npm:7.0.4
      ├─ dotenv@npm:~10.0.0 → npm:10.0.0
      ├─ enquirer@npm:~2.3.6 → npm:2.3.6
      ├─ fast-glob@npm:3.2.7 → npm:3.2.7
      ├─ figures@npm:3.2.0 → npm:3.2.0
      ├─ flat@npm:^5.0.2 → npm:5.0.2
      ├─ fs-extra@npm:^11.1.0 → npm:11.1.0
      ├─ glob@npm:7.1.4 → npm:7.1.4
      ├─ ignore@npm:^5.0.4 → npm:5.2.0
      ├─ js-yaml@npm:4.1.0 → npm:4.1.0
      ├─ jsonc-parser@npm:3.2.0 → npm:3.2.0
      ├─ lines-and-columns@npm:~2.0.3 → npm:2.0.3
      ├─ minimatch@npm:3.0.5 → npm:3.0.5
      ├─ npm-run-path@npm:^4.0.1 → npm:4.0.1
      ├─ open@npm:^8.4.0 → npm:8.4.1
      ├─ semver@npm:7.3.4 → npm:7.3.4
      ├─ string-width@npm:^4.2.3 → npm:4.2.3
      ├─ strong-log-transformer@npm:^2.1.0 → npm:2.1.0
      ├─ tar-stream@npm:~2.2.0 → npm:2.2.0
      ├─ tmp@npm:~0.2.1 → npm:0.2.1
      ├─ tsconfig-paths@npm:^4.1.2 → npm:4.1.2
      ├─ tslib@npm:^2.3.0 → npm:2.5.0
      ├─ v8-compile-cache@npm:2.3.0 → npm:2.3.0
      ├─ yargs-parser@npm:21.1.1 → npm:21.1.1
      └─ yargs@npm:^17.6.2 → npm:17.6.2

marcincichocki avatar Apr 18 '23 16:04 marcincichocki

@marcincichocki Nx changed something internally. The 15.7 nxext package support Nx 15.7. I hadn’t time to update everything that changed

DominikPieper avatar Apr 18 '23 16:04 DominikPieper

I can confirm the issue and as a workaround, downgrading to Nx 15.7.2 works.

CleanShot 2023-04-23 at 11 25 35@2x

Also, to work with the latest @stencil/core v3, I need to override the dependency of @nxext/stencil in the packages.json. Same if you are trying to integrate the latest Storybook v7 in your component library.

dgonzalezr avatar Apr 23 '23 08:04 dgonzalezr

Yeah, it's still not working for me with [email protected] and @nxext/[email protected]. I still get Cannot find module '@nrwl/workspace/src/utilities/ast-utils' when trying to use @nxext/stencil:lib

MrGrigri avatar Apr 24 '23 16:04 MrGrigri

@dgonzalezr storybook v7 works only with nrwl 15.9.x no?

erichstark avatar Apr 27 '23 18:04 erichstark

Workaround for this problem is to install Stencil directly without using the @nxext/stencil extension and to create components, use the Stencil CLI.

oscarcornejo avatar May 05 '23 01:05 oscarcornejo

Workaround for this problem is to install Stencil directly without using the @nxext/stencil extension and to create components, use the Stencil CLI.

Hi! @oscarcornejo do you happen to have a working example using only the Stencil CLI?

luisalfonsosandoval avatar May 16 '23 18:05 luisalfonsosandoval

I worked around this by changing one line in @nxext/stencil 15.7.0 using a Yarn patch. I'm using NX 15.9.2. I have been using both without issues since.

I changed line 8 of @nxext/stencil/src/utils/ast-utils.js from

const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");

to

const ast_utils_1 = require("@nrwl/workspace/src/utils/ast-utils");

matsgottenbos avatar May 24 '23 10:05 matsgottenbos

Just recently tried nx and I got this issue too. And it took me a while to find out the bug being reported here. Instead of workaround shouldn't there be a good fix? Not a good experience for the first timer using Nx

NOI-lgtm avatar Jun 10 '23 10:06 NOI-lgtm

same issue here

image

looking forward to the patch. Considering using Stencil CLI as @oscarcornejo suggests.

alexco95 avatar Jun 21 '23 14:06 alexco95

I worked around this by changing one line in @nxext/stencil 15.7.0 using a Yarn patch. I'm using NX 15.9.2. I have been using both without issues since.

I changed line 8 of @nxext/stencil/src/utils/ast-utils.js from

const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");

to

const ast_utils_1 = require("@nrwl/workspace/src/utils/ast-utils");

How do you use that patch? It is possible also if I have been using pnpm instead of yarn?

erichstark avatar Jun 27 '23 19:06 erichstark

How do you use that patch? It is possible also if I have been using pnpm instead of yarn?

@erichstark I used yarn patch: https://yarnpkg.com/cli/patch Not familiar with pnpm, but there seems to be something similar: https://pnpm.io/cli/patch

matsgottenbos avatar Jun 27 '23 20:06 matsgottenbos