question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When selecting "separate config files", cli should .browserslistrc over package.json

See original GitHub issue

Version

3.0.0-alpha.9

Steps to reproduce

  1. vue create demo-app
  2. Select “In dedicated config files” on the question "Where do you prefer placing config for Babel, PostCSS, ESLint, etc.?"

What is expected?

browserlist config to be in .browserlistrc file

What is actually happening?

The browserlist config is in the package.json

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
LinusBorgcommented, May 7, 2018

https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli/lib/util/configTransforms.js

By default, all configs are written into package.json. If the user selects “separate config files”, the tranforms defined in the above file will be used to extract configs from package.json into these files.

So you would have to define a new transform for the browserslist field in that file.

That could maybe be as simple as adding this to the export:

module.exports = {
  vue: makeJSTransform('vue.config.js'),
  babel: makeJSONTransform('.babelrc'),
  postcss: makeMutliExtensionJSONTransform('.postcssrc', true),
  eslintConfig: makeMutliExtensionJSONTransform('.eslintrc', true),
  jest: makeJSTransform('jest.config.js')
  browserslist: makeJSONTransform('.browserslistrc')
}

If we make this change, we have to make sure that these plugins actually respect .browserslistrc:

  1. babel-preset-env
  2. postcss autoprefixer
0reactions
LinusBorgcommented, May 7, 2018

https://github.com/browserslist/browserslist#browserslist-

The .browserlistrc file seems to have a different syntax after all, it’s not 100% JSON? You might have to write a new transform for that, probably.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pierre GAMBAROTTO / Maquette_fork · GitLab - PLMlab - CNRS
Browserslist will take queries from tool option, browserslist config, .browserslistrc config, browserslist section in package.json or environment variables.
Read more >
What is PostCSS? How to Use Plugins to Automate CSS Tasks
We can configure our command to run in PostCSS CLI with different options to get our desired result. Now to run the command...
Read more >
babel/preset-env
json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
Read more >
How to include custom files with angular-cli build?
The "assets" property of angular-cli.json can be configured to include custom files in angular-cli webpack build. So, configure "assets" property value as ...
Read more >
Getting started with Vue - Learn web development | MDN
Now, you will select how we want your config files to be managed. ... The Vue CLI will default to this package manager...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found