rspack withNx config ignoring library dependencies
hanstf opened this issue · comments
Hans Tjipto commented
Current Behavior
Currently we are trying to migrate our nestjs based project from webpack to rspack, it seems that we always receive this error:
ERROR in ./node_modules/@nestjs/microservices/server/server-redis.js
× Resolve error: Can't resolve 'ioredis' in '/Users/hans/Documents/projects/project_name/node_modules/@nestjs/microservices/server'
╭─[16:1]
16 │ this.transportId = enums_1.Transport.REDIS;
17 │ this.isExplicitlyTerminated = false;
18 │ redisPackage = this.loadPackage('ioredis', ServerRedis.name, ()=>require('ioredis'));
· ──────────────────
19 │ this.initializeSerializer(options);
20 │ this.initializeDeserializer(options);
╰────
the @nestjs/microservices is not directly used by the project but instead used by the internal library that used by the project.
our rspack config is quite standard:
module.exports = composePlugins(withNx(), (config, {options, context}) => {
// customize Rspack config here
config.entry = {
main: './apps/auth/src/main.ts',
migrate: './apps/auth/src/migrate.ts',
seed: './apps/auth/src/seed.ts',
inspect: './apps/auth/src/inspect.ts'
};
return config;
});
Upon checking it seems that none of the project's library dependencies are included in the externals. Not sure is it expected but it seems that the withWebpack was having different behaviour that ignoring all the node_modules.
Expected Behavior
The project's library dependencies is included inside the externals
GitHub Repo
No response
Steps to Reproduce
- Create project that using library as the dependency
- Build the project with rspack
Nx Report
NX Report complete - copy this into the issue template
Node : 18.18.2
OS : darwin-arm64
npm : 9.8.1
nx : 19.4.2
@nx/js : 19.4.2
@nx/jest : 19.4.2
@nx/linter : 19.4.2
@nx/eslint : 19.4.2
@nx/workspace : 19.4.2
@nx/devkit : 19.4.2
@nx/eslint-plugin : 19.4.2
@nx/nest : 19.4.2
@nx/node : 19.4.2
@nx/plugin : 19.4.2
@nrwl/tao : 19.4.2
@nx/webpack : 19.4.2
typescript : 5.4.5
---------------------------------------
Community plugins:
@nx/rspack : 19.2.0
---------------------------------------
Local workspace plugins:
generator
Failure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response