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.

info() not seeing browserlist configuration

See original GitHub issue

This is similar to #838.

When using 7.1.6, the info() method on the plugin returns the default list of browsers no matter what your configuration is.

Example usage:

.browserslistrc (or browserslist, or package.json)

safari >= 6

gulpfile.js

var autoprefixer = require('autoprefixer');

var ap = autoprefixer({
	cascade: false,
	add: true,
	remove: false,
	supports: true,
	flexbox: true,
	grid: false
});

console.log(ap.info());

Results in this output:

Browsers:
  Chrome for Android: 61
  Firefox for Android: 56
  And_qq: 1.2
  UC for Android: 11.4
  Android: 56, 4.4.3-4.4.4
  Baidu: 7.12
  Bb: 10, 7
  Chrome: 62, 61, 60, 49
  Edge: 16, 15
  Firefox: 56, 55, 52
  IE: 11, 10
  IE Mobile: 11, 10
  iOS: 11, 10.3, 10.0-10.2
  Opera Mini: all
  Opera Mobile: 37, 12.1
  Opera: 48, 47
  Safari: 11, 10.1
  Samsung: 5, 4

Where the correct output would look like:

Browsers:
  Safari: 11, 10.1, 10, 9.1, 9, 8, 7.1, 7, 6.1, 6

Looking into the code, I believe the issue is that the plugin.info method’s opts var is undefined since nothing is passed in (as per the docs).

I believe the fix is to change line 96 to be:

return require('./info')(loadPrefixes({ from: path.resolve('.') }));

I’d be happy to make a PR to this effect, but I wanted to open a discussion first!

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
aicommented, Oct 27, 2017

You must provide from option

console.log(ap.info({ from: process.cwd() }));

But I understand that it is not clear. There are 2 options:

  1. Add default value (process.cwd) to from. But if users will have different configs (like src/legacy/.browserslistrc), they will not know how to load it properly.
  2. Show warning on missed from option.

What do you think?

0reactions
aicommented, Nov 5, 2017

Sorry. Grid fix was delayed. Hope to release it on next week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

caching - Angular 12 ignoring configuration files or reading ...
The following answer assumes you are using npm as package manager · Ensure that you dont have browserlist in your package.json "browserslist": [ ......
Read more >
browserslist - npm
The config to share target browsers and Node.js versions between different front-end tools. It is used in: Autoprefixer · Babel · postcss-preset ...
Read more >
Browserslist on Twitter: "Browserslist 4.21 was released. — IE ...
Browserslist 4.21 now have browserslist.parse() method. It will find Browserslist config and return AST of this config.
Read more >
Supported Browsers and Features | Create React App
The browserslist configuration controls the outputted JavaScript so ... This is due to an issue in babel-loader not detecting the change in ...
Read more >
Pierre GAMBAROTTO / Maquette_fork · GitLab - PLMlab - CNRS
Browsers that we support defaults not IE 11 not IE_Mob 11 maintained node versions ... Browserslist will take queries from tool option, browserslist...
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