If a project has a browserslist config file, npm will fail to install the browserslist package. The config file is mistaken for a local node.js package, and npm fails with an npm ERR! not a package error.
$ mkdir -p /tmp/bl && cd $_$ echo last 4 versions > browserslist$ npm install browserslistnpm ERR! not a package /private/tmp/bl/browserslist
npm ERR! addLocal Could not install /private/tmp/bl/browserslist
[...]
naive expected result: install the browserslist package from npm
naive becase everything's actually working correctly, just that the filename conflicts
actual result: error, package does not install
Any chance the project could support an alternate config file name like .browserslist, browserslist.config or browserlistrc? My preference would be a dotfile, which would fit in nicely with the ever-growing collection of like-named config files from other tools.
I think we could add .browserslist config name in next major release and promote only it in docs (but still support browserslist config with warnings).
I will do it together with #98
Because this issue is not critical, I will fix it after few weeks. Don鈥檛 want to make major Autoprefixer release on holidays :D
wouldn't .browserlistrc be a 'more standard' choice ?
@brokenmass I am not big fan of rc postfix. It is longer and less readable. But I could rethink about it if there is some standard about names.
I was suggesting because of the many project that use the rc postfix like:
.nvmrc .npmrc .babelrc .eslintrc.json .stylelintrc.json .jshintrc, ...
It might prove useful for people that whitelists dotfiles in .gitignore (instead of blacklisting) as they will be able to do:
.*
!.gitignore
!.*rc*
I'm not very opinionated about the rc postfix but I think it has become a de facto standard and not following it might just generate confusion for the average user.
It looks good for small names but browserslist in my opinion is too tiny for it.
Filter reason vis good, but there is no good reason to add this config to fit ignore 馃槈.
Done 7231ccd
Will be released in 2.0.
Most helpful comment
I think we could add
.browserslistconfig name in next major release and promote only it in docs (but still supportbrowserslistconfig with warnings).