yalc
yalc copied to clipboard
[BUG] yalc add does not include the same files as npm pack & publish
This happens only if there is a node_modules
directory in the build
directory. This happens in one of the packages of my client. The reason is that during the build process, polyfills with babel are added with an import statement in the resulting .js
files. The import statement is relative to the node_modules
directory in the build directory, which contains only the babel polyfills.
If I do npm pack
, it will pack the node_modules
directory in the tarball. It also copies it to the ~/.yalc
directory. But yalc add
does not include it.
The reason is that in src/syncDir.ts
, there is a hardcoded const ignore = '**/node_modules/**'
.
In my opinion this should be removed because it differs from the actual behaviour of npm pack
and it conflicts with what is stated in the README.md: "It will copy all the files that should be published in remote NPM registry."
Instead I suggest to provide a --ignore-node-modules
flag to yalc add
.
I'm having this same problem, Yalc publish is not doing the same as npm pack/publish does, because npm pack clearly lists the node_modules and I get those in the actual published package.