wclr / yalc

Work with yarn/npm packages locally like a boss.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] yalc add does not include the same files as npm pack & publish

timbicker opened this issue · comments

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.