How to use the loadConfig function from browserslist

Find comprehensive JavaScript browserslist.loadConfig code examples handpicked from public code repositorys.

17
18
19
20
21
22
23
24
25
26
27
28
const topLevelFrameworkPaths = isDevelopment ? [] : getTopLevelFrameworkPaths(__dirname);
const isAnalyze = !!process.env.ANALYZE;
const cpuCount = require('os').cpus().length;
const context = __dirname;


const targets = browserslist.loadConfig({ path: context});


/** @type {import('webpack').Configuration} */
const config = {
  mode: isDevelopment ? 'development' : 'production',
fork icon0
star icon19
watch icon1

+ 13 other calls in file

57
58
59
60
61
62
63
64
65
66
// if a path to a config is specified then load it, else
// find a nearest config
const config = query
	? query
	: configPath
	? browserslist.loadConfig({
			config: configPath,
			env
	  })
	: browserslist.loadConfig({ path: context, env });
fork icon0
star icon0
watch icon1

188
189
190
191
192
193
194
195
196
197
const shouldParseBrowsers = !!browsers;
const hasTargets = shouldParseBrowsers || Object.keys(targets).length > 0;
const shouldSearchForConfig = !options.ignoreBrowserslistConfig && !hasTargets;

if (!browsers && shouldSearchForConfig) {
  browsers = _browserslist.loadConfig({
    config: options.configFile,
    path: configPath,
    env: options.browserslistEnv
  });
fork icon0
star icon0
watch icon1

192
193
194
195
196
197
198
199
200
201
const shouldParseBrowsers = !!browsers;
const hasTargets = shouldParseBrowsers || Object.keys(targets).length > 0;
const shouldSearchForConfig = !options.ignoreBrowserslistConfig && !hasTargets;

if (!browsers && shouldSearchForConfig) {
  browsers = browserslist.loadConfig({
    config: options.configFile,
    path: configPath,
    env: options.browserslistEnv
  });
fork icon0
star icon0
watch icon1