Support naming Webpack configs

master
Futago-za Ryuu 5 years ago
parent 5f8344395c
commit afeb2a3330

@ -1,6 +1,6 @@
{ {
"name": "@pegjs/bundler", "name": "@pegjs/bundler",
"version": "3.1.0", "version": "3.2.0",
"private": true, "private": true,
"bin": { "bin": {
"bundle": "bundler.js" "bundle": "bundler.js"

@ -4,7 +4,14 @@ const dedent = require( "dedent" );
const path = require( "path" ); const path = require( "path" );
const webpack = require( "webpack" ); const webpack = require( "webpack" );
function target( { banner, entry, library, minimize, output } ) { /**
* A wrapper function to help create a configuration for Webpack.
*
* @param {{banner?: string, entry: string, library: string, minimize?: boolean, name?: string, output: string}} param0
* @returns {{}}
*/
function target( { banner, entry, library, minimize, name, output } ) {
const cwd = process.cwd(); const cwd = process.cwd();
const plugins = []; const plugins = [];
@ -19,6 +26,7 @@ function target( { banner, entry, library, minimize, output } ) {
return { return {
name,
mode: process.argv.includes( "--mode=development" ) ? "development" : "production", mode: process.argv.includes( "--mode=development" ) ? "development" : "production",
entry, entry,
output: { output: {

Loading…
Cancel
Save