Open
Description
Current Behavior
It's not possible to use the exports
field for packages in the same monorepo as apps that use Webpack to build and serve the application.

Expected Behavior
it's possible to import modules that defined via "exports" from package inside monorepo
GitHub Repo
lazy-orange/nx-workspace-v20#2
Steps to Reproduce
- yarn install
- yarn nx run buz:build
Nx Report
NX Report complete - copy this into the issue template
Node : 20.18.0
OS : darwin-arm64
Native Target : aarch64-macos
yarn : 1.22.22
nx : 20.1.4
@nx/js : 20.1.4
@nx/jest : 20.1.4
@nx/eslint : 20.1.4
@nx/workspace : 20.1.4
@nx/devkit : 20.1.4
@nx/esbuild : 20.1.4
@nx/eslint-plugin : 20.1.4
@nx/nest : 20.1.4
@nx/node : 20.1.4
@nx/web : 20.1.4
@nx/webpack : 20.1.4
typescript : 5.5.4
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
ngx-deploy-npm : 8.2.0
✨ Done in 0.75s.
Failure Logs
yarn run v1.22.22
$ /Users/administrator/Projects/dayio/nx-workspace-v20/node_modules/.bin/nx run buz:build
Nx is configured to use the legacy cache. This cache will be removed in Nx 21. Read more at https://nx.dev/deprecated/legacy-cache.
> nx run buz:build
> webpack-cli build node-env=production
chunk (runtime: main) main.js (main) 2.79 KiB [entry] [rendered]
ERROR in ./src/main.ts 10:16-55
Module not found: Error: Can't resolve '@lazy-orange/date-time/utils' in '/Users/administrator/Projects/dayio/nx-workspace-v20/apps/buz/src'
ERROR in ./src/main.ts:9:21
TS2307: Cannot find module '@lazy-orange/date-time/utils' or its corresponding type declarations.
7 | import { NestFactory } from "@nestjs/core";
8 | import { AppModule } from "./app/app.module";
> 9 | import { now } from "@lazy-orange/date-time/utils";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 |
11 | async function bootstrap() {
12 | const app = await NestFactory.create(AppModule);
webpack compiled with 2 errors (ac1dd785c7fc9bf4)
Warning: command "webpack-cli build node-env=production" exited with non-zero status code
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target build for project buz (1s)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Package Manager Version
1.22.2
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
Activity