vercel/webpack-asset-relocator-loader

Support for symlinks

artus9033 opened this issue · 4 comments

It seems like Webpack 5 now has support for emitting symbolic links by resolving them, if resolve.symlinks is not explicitly set to false.
Maybe this module could move out the logic that discards detected symlinks thanks to the change? A specific use case I am thinking of is npm link or file: installation of local packages.

@artus9033 the symlinks implementation here was implemented to support native symlinks which some packages use to reference platform binaries. While npm doesn't support symlinks I believe some packages create them during their scripts.

If linked packages are not building correctly for you, then we should assess the fix based on the specific use case and decide the best way to achieve it. Do you have an exact replication / scenario here in mind?

Sorry, now I see the problem actually lies in a fork of this project (https://www.npmjs.com/package/@marshallofsound/webpack-asset-relocator-loader/), but the package homepage contains a link to this repository. Therefore I think this issue is obsolete, but thanks for the response anyway.

Posting here even tho the issue is closed. I'm having a similar issue (electron-forge + @MarshallOfSound's fork), but I'm not sure if the problem lies in the fork I'm using, webpack-asset-relocator-loader in general, or webpack itself,

I'm using yarn workspaces which symlinks the native addon. The addon is linked fine in TypeScript, but the webpack build just isn't outputting it. This is my folder structure:

.
└── forge-app/
    ├── .webpack/
    ├── package.json
    ├── node_modules/
    │   └── native-addon / ↩ (symlinked from ../native-addon)
    │       ├── node_modules / ↩
    │       └── build / ↩
    │           └── Release / ↩
    │               └── video-module.node ↩
    ├── app/
    │   ├── index.ts
    │   ├── preload.ts
    │   └── render.ts
    └── native-addon/
        ├── package.json
        ├── node_modules
        └── build/
            └── Release/
                └── video-module.node

./package.json:

  "workspaces": [
    "native-addon"
  ],

I've added a minimal reproduction repo here: https://github.com/ivancuric/forge-symlink

@ivancuric right, this looks the same as in my case - seems we are dealing with that same problem