Yarn: .npmignore and files are ignored in favor of .gitignore

Created on 24 Mar 2017  路  5Comments  路  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?

Bug

Dup https://github.com/yarnpkg/yarn/issues/685 and https://github.com/yarnpkg/yarn/issues/754 of just to draw attention because yarn publish command is unusable now.

What is the current behavior?

yarn pack looks in .gitignore to skip files even if .npmignore (not so matter caz npm specific) or files field are present.

What is the expected behavior?

prefer files field over .gitignore

Please mention your node.js, yarn and operating system version.

yarn0.21.3, node6

Most helpful comment

For everyone who came here, because your directories with compiled js files were not published because they were in gitignore

use this .npmignore

# ignore everything
/*

# except
!es
!lib

All 5 comments

Yes, should not consider .gitignore if there is .npmignore/.yarnignre in place, seem to be kind of broken behaviour.

@bestander

Closing this one, since it's a dupe.

For everyone who came here, because your directories with compiled js files were not published because they were in gitignore

use this .npmignore

# ignore everything
/*

# except
!es
!lib

@BjornMelgaard Thanks, I had to use !lib/*.

@BjornMelgaard @korneel Thanks for leaving these notes here. I had to do this to make it work:

# ignore everything
*/**

# except
!lib-cjs/**/*
!lib-esm/**/*
Was this page helpful?
0 / 5 - 0 ratings