-
Notifications
You must be signed in to change notification settings - Fork 58
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
Unable to Compile with Webpack #300
Comments
There is some discussion of a similar issue at #264 (comment) I think the code could be changed to use non-dynamic requires, it would just be more verbose. |
I thought that as well, but it is a bit different or potentially a different solution dealing with Electron. I think perhaps a switch statement to include the correct library based on the different variables might work better, but as you said would be much more verbose. |
Fixed by #303 |
I have a NodeJs webserver that currently utilizes Webpack 5.75.0. Due to the way this library dynamically requires/imports the needed dll file, I receive a warning from Webpack
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
./node_modules/node-api-dotnet/init.js
@ ./node_modules/node-api-dotnet/index.js 1:19-36
This ends up with a runtime error when I try to require node-api-dotnet
An unknown error occurred: Error: Cannot find module '....WebServer/win-x64/Microsoft.JavaScript.NodeApi.node'
From what I've read it sounds like it's generally bad practice to dynamically require files since it can cause issues like this, though I'm not sure what a better approach would be. I've been trying to figure out a way to work around the issue and didn't see anything in your documentation or tracked issues about this. Any help would be appreciated.
The text was updated successfully, but these errors were encountered: