Replies: 17 comments 10 replies
-
Sorry, we don't support |
Beta Was this translation helpful? Give feedback.
-
Thank you for reply. |
Beta Was this translation helpful? Give feedback.
-
Semms, that this option is for stage, when webpack build sources, but not for |
Beta Was this translation helpful? Give feedback.
-
Remember, that my case is for webpack config dependencies. No options to fix this? |
Beta Was this translation helpful? Give feedback.
-
@alexander-akait |
Beta Was this translation helpful? Give feedback.
-
@alexander-akait
|
Beta Was this translation helpful? Give feedback.
-
Hi. Reproduction is ready. How to reproduce# clone repo
git clone https://github.com/zdm/webpack-build-dependencies-issue-17169
cd webpack-build-dependencies-issue-17169
cd main
# this command:
# - installs dependencies
# - links "package-a" and "package-b" to the "main/node_modules"
npm i
# this command runs:
# node --preserve-symlinks node_modules/webpack/bin/webpack.js
npm run build Build is OK, but cache is not used due to the following errors: <w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'package-b/webpack.config.js' in 'd:\projects\devel\issues\webpack-build-dependencies-issue-17169\package-a'
<w> while resolving 'package-b/webpack.config.js' in d:\projects\devel\issues\webpack-build-dependencies-issue-17169\package-a as file
<w> at resolve esm file package-b/webpack.config.js
<w> at file dependencies d:\projects\devel\issues\webpack-build-dependencies-issue-17169\package-a\webpack.config.js
<w> at file d:\projects\devel\issues\webpack-build-dependencies-issue-17169\package-a\webpack.config.js
<w> at resolve esm file package-a/webpack.config.js
<w> at file dependencies d:\projects\devel\issues\webpack-build-dependencies-issue-17169\main\webpack.config.js
<w> at file d:\projects\devel\issues\webpack-build-dependencies-issue-17169\main\webpack.config.js
<w> at resolve commonjs d:\projects\devel\issues\webpack-build-dependencies-issue-17169\main\webpack.config.js
.. |
Beta Was this translation helpful? Give feedback.
-
Seems, that |
Beta Was this translation helpful? Give feedback.
-
This is not so rare case, this is very helpful when you for example need to work both on the end-user application and the shared web components libraries. Interesting, that deps resolver failed only for build dependencies, but works for the same dependencies in the main build process. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Did you considered to use built-in node resolcer.
It will work 100% correctly. Only need to add support for custom aliases and some other features, which are used in webpack. I can create the code. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to access resolver, which is used to resolve build deps? I want to try to add plugin. |
Beta Was this translation helpful? Give feedback.
-
Easiest way is to ask Trump to make webpack great again. |
Beta Was this translation helpful? Give feedback.
-
We can do it, I doubt it only because all the time using webpack you are the first and only one who has encountered this...
I honestly can't understand what the problem is with using dependencies using I want to help you, I want to say that's such behavior is extremely undesirable and you could potentially get into serious trouble - your dependency tree is broken. The problem will be especially evident with transitive dependencies. And I don’t understand why you ignore the direct words from the author of the project that this approach is dangerous. As well as direct words from the developer of the node:
|
Beta Was this translation helpful? Give feedback.
-
In my reproduction I didn't specified dependencies, because package-a and package-b are not published. Generally - it works, project compiled, but without cache. I am unable to be happy, when something not works. |
Beta Was this translation helpful? Give feedback.
-
Is it possible to use hooks for resolvers that are used to resolve build dependencies? |
Beta Was this translation helpful? Give feedback.
-
Please add, I you can. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
My
webpack congig
depends onpackage-a
.package-a
is depends onpackage-b
;For development purposes packages
package-a
andpackage-b
symlinked to thenode_modules
.I set
NODE_PRESERVE_SYMLINKS=1
, so nodejs will not resolves symlinks.I added my
webpack congig
location to thecache.buildDependencies
.Whe I am running build process I got error:
package-b
can't be resolved from thepackage-a
.And in error message it shows original
package-a
location (not symlink location).So, seems, that when webpack resolves
cache.buildDependencies
dependencies it does not respectNODE_PRESERVE_SYMLINKS=1
and follwos symbolic links.This disables filesysten cache.
What is the expected behavior?
I am expecting, that when
NODE_PRESERVE_SYMLINKS=1
is set - modules resilver will not follw symbolic links. As it implemented in the nodejs.Other relevant information:
webpack version: 5.82.0
Node.js version: 20.0.1
Operating System: win / linux
Additional tools: none
Beta Was this translation helpful? Give feedback.
All reactions