-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] NX 13 and Webpack5 Support #123
Comments
Hey guys, I tried migrating to nx-13 and got stuck and webpack typings used to build and dependency tree shaking Would you guys have time to chip in? We have a slack channel we can discuss and go thru it together |
Sure, how can I join the channel? |
the migrated workspace is in the error is libs/nx-serverless/src/utils/depcheck.ts:42:20 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
42 webpackStats?: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/node.config.ts:27:7 - error TS2322: Type '(context: any, request: any, callback: Function) => any' is not assignable to type 'ExternalItem'.
Type '(context: any, request: any, callback: Function) => any' is not assignable to type '(data: ExternalItemFunctionData, callback: (err?: Error, result?: string | boolean | string[] | { [index: string]: any; }) => void) => void'.
27 function (context, request, callback: Function) {
~~~~~~~~
libs/nx-serverless/src/utils/node.config.ts:42:10 - error TS2349: This expression is not callable.
Type 'typeof import("D:/projects/flowaccount/nx-plugins/node_modules/webpack-merge/dist/index")' has no call signatures.
42 return mergeWebpack(getBaseWebpackPartial(options), getNodePartial(options));
~~~~~~~~~~~~
libs/nx-serverless/src/utils/packagers/index.ts:39:10 - error TS2724: '"webpack"' has no exported member named 'compilation'. Did you mean 'Compilation'?
39 import { compilation, Stats } from 'webpack';
~~~~~~~~~~~
libs/nx-serverless/src/utils/packagers/index.ts:67:10 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
67 stats: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/types.ts:82:18 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
82 webpackStats?: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/webpack.stats.ts:16:20 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
16 webpackStats?: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/webpack.stats.ts:58:29 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
58 getExternalModules(stats: Stats.ToJsonOutput) {
~~~~~
libs/nx-serverless/src/utils/depcheck.ts:42:20 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
42 webpackStats?: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/node.config.ts:27:7 - error TS2322: Type '(context: any, request: any, callback: Function) => any' is not assignable to type 'ExternalItem'.
Type '(context: any, request: any, callback: Function) => any' is not assignable to type '(data: ExternalItemFunctionData, callback: (err?: Error, result?: string | boolean | string[] | { [index: string]: any; }) => void) => void'.
27 function (context, request, callback: Function) {
~~~~~~~~
libs/nx-serverless/src/utils/node.config.ts:42:10 - error TS2349: This expression is not callable.
Type 'typeof import("D:/projects/flowaccount/nx-plugins/node_modules/webpack-merge/dist/index")' has no call signatures.
42 return mergeWebpack(getBaseWebpackPartial(options), getNodePartial(options));
~~~~~~~~~~~~
libs/nx-serverless/src/utils/packagers/index.ts:39:10 - error TS2724: '"webpack"' has no exported member named 'compilation'. Did you mean 'Compilation'?
39 import { compilation, Stats } from 'webpack';
~~~~~~~~~~~
libs/nx-serverless/src/utils/packagers/index.ts:67:10 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
67 stats: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/types.ts:82:18 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
82 webpackStats?: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/webpack.stats.ts:16:20 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
16 webpackStats?: Stats.ToJsonOutput,
~~~~~
libs/nx-serverless/src/utils/webpack.stats.ts:58:29 - error TS2702: 'Stats' only refers to a type, but is being used as a namespace here.
58 getExternalModules(stats: Stats.ToJsonOutput) {
~~~~~
error Command failed with exit code 1. |
That looks like it could be related to changes in webpack 5’s exports. I’ve not touched it yet, I may be able to dig around tomorrow, but at least in my usage I’m still not on the latest version of anything yet. |
sorry i was out for a few days. Is the invite already expired? I'm not able to find any workspace with my github email. |
branch
|
now i am stuck here, while building the webpack. Anyone can help?
|
we need to migrate |
Describe the bug
We are upgrading the app to nx 13, and nx 13 seems to only support webpack5. We are getting the errors below when building the serverless app:
The root of the issue is the
run-webpack
function. In Nx13, this function is updated and moved from the @nrwl/workspace to @nrwl/node. So we need a way to pick the correct version based on the version of nxIs there a way to use nx13 with this plugin?
To Reproduce
Steps to reproduce the behavior:
nx build my-serverless-app
Check which provider is affected:
[x] AWS
Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code
Additional context
The text was updated successfully, but these errors were encountered: