nx icon indicating copy to clipboard operation
nx copied to clipboard

@nx/angular:browser-esbuild not founds custom plugins

Open mcfdez opened this issue 1 year ago • 1 comments

Current Behavior

When I launch the build command with @nx/angular:browser-esbuild and custom plugins , I get an error that the plugins file is not found, and the plugins file exists:

"executor": "@nx/angular:browser-esbuild",
    "outputs": ["{options.outputPath}"],
    "options": {
        "plugins": [
            "tools/scripts/frontend-bundler.js"
        ]
...

Image Image

> nx run @frontend:build-client:proLocal --watch
NX   Cannot find module 'code/tools/builders/frontend/plugin1.js'

Image

Expected Behavior

Plugin path configuration should work.

GitHub Repo No response

Steps to Reproduce Add @nx/angular:browser-esbuild as an executor to build the application. Create a JS file for a plugin. Reference that file in the project.json configuration. Execute the build command.

Nx Report Node : 18.12.1 OS : linux-x64 npm : 8.19.2

nx : 18.2.4 @nx/js : 18.2.4 @nx/jest : 18.2.4 @nx/linter : 18.2.4 @nx/eslint : 18.2.4 @nx/workspace : 18.2.4 @nx/angular : 18.2.4 @nx/devkit : 18.2.4 @nx/esbuild : 18.2.4 @nx/eslint-plugin : 18.2.4 @nx/node : 18.2.4 @nx/plugin : 18.2.4 @nx/react : 18.2.4 @nrwl/tao : 18.2.4 @nx/vite : 18.2.4 @nx/web : 18.2.4 @nx/webpack : 18.2.4 typescript : 5.3.3

Community plugins: @ngrx/effects : 17.1.1 @ngrx/router-store : 17.1.1 @ngrx/store : 17.1.1 @ngrx/store-devtools : 17.1.1 ng-mocks : 14.12.1

Failure Logs NX Cannot find module 'tools/scripts/frontend-bundler.js'

Package Manager Version NPM 8.19.2

Operating System Linux

mcfdez avatar Oct 17 '24 14:10 mcfdez

The problem is derived from here: (node_modules/@nx/angular/src/executors/utilities/module-loader.js)

Image

When the default of the switch is entered, the require looks for the file that is passed through the path variable, but it is not able to find it. I think we should add a __dirname there.

mcfdez avatar Oct 17 '24 19:10 mcfdez

I can't reproduce this on the latest version of Nx (20.0.6). Can you retry with that?

Coly010 avatar Oct 29 '24 12:10 Coly010

This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. It will be closed in 21 days if no results are provided. If the issue is still present, please reply to keep it active. If the issue was not present, please close this issue. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Nov 06 '24 00:11 github-actions[bot]

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Dec 28 '24 00:12 github-actions[bot]