-
Notifications
You must be signed in to change notification settings - Fork 33
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
[Windows] Path parts in strings replaced with undefined #161
Comments
I am observing the same problem on Windows 11, using Electron Forge. Same code works fine on Linux. I also tried with an older node version (14.19.2), and an older version of this repo (1.6.0), but no luck. On my side, it seems like /***/ "./src/<a subproject>/build/Release/<subproject_module>.node":
/*!***************************************************************************!*\
!*** ./src/<a subproject>/build/Release/<subproject_module>.node ***!
\***************************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = require(__webpack_require__.ab + "<subproject_module>.node")
/***/ }), If I manually substitute I'd be grateful for any workaround or suggestions, as the manual approach doesn't really map out when packaging for production, as webpack can't then apply its path substitution, and it seems like the relative path import trick I use in development doesn't work in the packaged file. I'm also available to help tracing down this bug. More info:
|
This comment solved the problem for me: tl;dr: forge’s config can’t handle every type of native module. Some need to be marked as external. If you try to get the code in that issue working it may work for you as well. |
Thanks @jamesplease, that did the trick. It only works in development mode though (for me), but using https://github.com/timfish/forge-externals-plugin solved that and now it also packages correctly. |
I also had to add the externals plugin for builds. Glad you got it working! |
is there a workaround for this ? |
This is still an issue that should be easily fixable. I'm trying to debug where it all goes wrong. |
I still cannot pinpoint exactly where the plugin is failing, but if I import a native node module in the webpack entry, instead of importing from another file, then the EDIT: caching the webpack build results in the same error, which means it's a problem with checking if the file requesting the |
OS: Windows 11
webpack-asset-relocator-loader version: 1.7.2
Node version: 16.15.0
Configuration
What is the behavior that I'm seeing
Any string containing paths to the project has that pieceof the string replaced with
undefined
.What I would expect to see
Path parts not replaced with
undefined
.Example
In this example, the project is located at
C:\Users\example-user\web\example-project
, and a file exists at.\src\some-path\some-file.txt
More Information
This is an Electron Forge application. The problem has been narrowed down to this plugin (removing the plugin fixes the issue)
The text was updated successfully, but these errors were encountered: