text: const path = require('path');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const {
  	SsrBdslWebpackPlugin,
  	getBrowserslistQueries,
  	getBrowserslistEnvList
  } = require('bdsl-webpack-plugin');
  
  const browserslistEnvList = getBrowserslistEnvList();
  
  /**
   * Create webpack config for given browsers.
   * @param  {string | string[]} [browsersOrEnv] - Browserslist queries or environment.
   * @return {object} Webpack config.
   */
  function createWebpackConfig(browsersOrEnv) {
  
  	const [
  		browsers,
  		env
  	] = browserslistEnvList.includes(browsersOrEnv)
  		? [undefined, browsersOrEnv]
  		: [browsersOrEnv];
  
  	return {
  		name:    browsersOrEnv,
  		mode:    'production',
  		entry:   './src/script.js',
  		output:  {
  			publicPath: '/',
  			path:       path.resolve(__dirname, 'build'),
  			filename:   'index.[hash].js'
  		},
  		module:  {
  			rules: [{
  				test:    /\.js$/,
  				exclude: /node_modules/,
  				loader:  'babel-loader',
  				options: {
  					cacheDirectory: true,
  					presets:        [
  						['@babel/preset-env', {
  							modules:     false,
  							useBuiltIns: 'usage',
  							corejs:      3,
  							targets:     browsers || getBrowserslistQueries({ env })
  						}]
  					],
  					plugins:        [
  						'@babel/plugin-proposal-class-properties',
  						'@babel/plugin-proposal-async-generator-functions',
  						['@babel/plugin-transform-runtime', {
  							useESModules: true,
  							regenerator: true,
  							corejs: false,
  						}]
  					]
  				}
  			}]
  		},
  		plugins: [
  			new HtmlWebpackPlugin({
  				template: 'src/index.html',
  				inject:   'head'
  			}),
  			new SsrBdslWebpackPlugin({
  				replaceTagsWithPlaceholder: true,
  				browsers,
  				env
  			})
  		]
  	};
  }
  
  module.exports = [
  	createWebpackConfig('modern'),
  	createWebpackConfig('last 2 years and not last 2 versions'),
  	createWebpackConfig()
  ];
  
  /*
  
  ...or just:
  
  module.exports = [
  	...browserslistEnvList,
  	undefined // to use default .browserslistrc queries
  ].map(createWebpackConfig);
  
  */
  