Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Bundle analyzer #4141

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
93a45c8
test
info-arnav Mar 13, 2024
80d7233
Merge branch 'master' of https://github.com/info-arnav/webpack-cli
info-arnav Mar 13, 2024
4355ebc
add: add boilerplate script
info-arnav Mar 13, 2024
5704492
add: react boilerplate
info-arnav Mar 13, 2024
1591b8d
add: react boilerplate
info-arnav Mar 13, 2024
78c59c8
feat: dot env plugin
info-arnav Mar 14, 2024
af339c9
main branch normal
info-arnav Mar 18, 2024
a2026f6
Merge branch 'master' of https://github.com/info-arnav/webpack-cli
info-arnav Mar 18, 2024
9565c0d
Merge branch 'master' of https://github.com/info-arnav/webpack-cli
info-arnav Mar 26, 2024
a2af2b2
Merge branch 'master' of https://github.com/info-arnav/webpack-cli
info-arnav Mar 29, 2024
b725d60
fix: removed boilerplate
info-arnav Mar 30, 2024
02ee878
fix: master
info-arnav Mar 30, 2024
b69badf
feat: creating a new bundle-analyzer-plugin in webpack itself
info-arnav Mar 31, 2024
66ebe4e
Merge branch 'master' of https://github.com/info-arnav/webpack-cli
info-arnav Apr 6, 2024
3f4ff05
feat: added flags for bundle-analyzer-plugin
info-arnav Apr 6, 2024
569503c
Merge branch 'bundle-analyzer' of https://github.com/info-arnav/webpa…
info-arnav Apr 6, 2024
e667afe
fix: removed unneccesary parts
info-arnav Apr 6, 2024
6f24b14
fix: added analyze type to options
info-arnav Apr 7, 2024
f4f8d0e
fix: improved flags
info-arnav Apr 7, 2024
b417cce
fix: removed uneccessary stuff and moved file to bin directory
info-arnav Apr 7, 2024
40ca791
feat: moved flags to diff repo and imported them to file
info-arnav Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"words": [
"Atsumu",
"autoprefixer",
"treemap",
"Dont",
"barbaz",
"Cantarell",
"Chizuru",
Expand Down
159 changes: 159 additions & 0 deletions cli-flags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
"use strict";

module.exports = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? What problem does it solve?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the file is made to privde the flags for the bundle analyzer plugin, had kept it in the root directory for now. Will move it to appropriate place.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know if somethings wrong, or how to proceed further.

version: {
configs: [
{
type: "boolean",
multiple: false,
description: "Output the version number",
path: "version",
},
],
description: "Output the version number",
simpleType: "boolean",
multiple: false,
},
mode: {
configs: [
{
type: "enum",
values: ["server", "static", "json"],
multiple: false,
description: "The mode to run the analyzer in: server, static, or json.",
path: "mode",
defaultValue: "server",
},
],
description: "The mode to run the analyzer in: server, static, or json.",
simpleType: "string",
multiple: false,
},
report: {
configs: [
{
type: "string",
multiple: false,
description: 'Path to bundle report file that will be generated in "static" mode.',
path: "report",
defaultValue: "report.html",
},
],
description: 'Path to bundle report file that will be generated in "static" mode.',
simpleType: "string",
multiple: false,
},
title: {
configs: [
{
type: "string",
multiple: false,
description: "String to use in title element of html report.",
path: "title",
defaultValue: "Webpack Bundle Report",
},
],
description: "String to use in title element of html report.",
simpleType: "string",
multiple: false,
},
size: {
configs: [
{
type: "enum",
values: ["stat", "parsed", "gzip"],
multiple: false,
description: "Module sizes to show in treemap by default.",
path: "defaultSizes",
defaultValue: "parsed",
},
],
description: "Module sizes to show in treemap by default.",
simpleType: "string",
multiple: false,
},
"Dont Open": {
configs: [
{
type: "boolean",
multiple: false,
description: "Don't open report in default browser automatically",
path: "noOpen",
defaultValue: false,
},
],
description: "Don't open report in default browser automatically",
simpleType: "boolean",
multiple: false,
},
port: {
configs: [
{
type: "number",
multiple: false,
description: "Port that will be used in `server` mode, default is 8888.",
path: "port",
defaultValue: 8888,
},
],
description: "Port that will be used in `server` mode, default is 8888.",
simpleType: "number",
multiple: false,
},
host: {
configs: [
{
type: "string",
multiple: false,
description: "Host that will be used in `server` mode, default is 127.0.0.1.",
path: "host",
defaultValue: "127.0.0.1",
},
],
description: "Host that will be used in `server` mode, default is 127.0.0.1.",
simpleType: "string",
multiple: false,
},
"log-level": {
configs: [
{
type: "enum",
values: ["debug", "info", "warn", "error", "silent"],
multiple: true,
description: "Level of logger (info, warn, error, silent).",
path: "logLevel",
defaultValue: "info",
},
],
description: "Level of logger (info, warn, error, silent).",
simpleType: "string",
multiple: true,
},
exclude: {
configs: [
{
type: "string",
multiple: false,
description: "Assets that should be excluded from the report.",
path: "exclude",
defaultValue: "",
},
],
description: "Assets that should be excluded from the report.",
simpleType: "string",
multiple: false,
},
help: {
configs: [
{
type: "boolean",
multiple: false,
description: "output usage information",
path: "help",
},
],
description: "Output usage information",
simpleType: "boolean",
multiple: false,
},
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webpack-cli-monorepo",
"description": "CLI for webpack & friends",
"license": "MIT",
"private": true,
"private": true,
info-arnav marked this conversation as resolved.
Show resolved Hide resolved
"repository": {
"type": "git",
"url": "https://github.com/webpack/webpack-cli.git"
Expand Down
Empty file modified packages/webpack-cli/bin/cli.js
100755 → 100644
Empty file.
1 change: 0 additions & 1 deletion packages/webpack-cli/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ type WebpackDevServerOptions = DevServerConfig &
nodeEnv?: "string";
watchOptionsStdin?: boolean;
progress?: boolean | "profile" | undefined;
analyze?: boolean;
prefetch?: string;
json?: boolean;
entry: EntryOptions;
Expand Down
25 changes: 11 additions & 14 deletions packages/webpack-cli/src/webpack-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class WebpackCLI implements IWebpackCLI {
constructor() {
this.colors = this.createColors();
this.logger = this.getLogger();

// Initialize program
this.program = program;
this.program.name("webpack");
Expand Down Expand Up @@ -972,32 +971,30 @@ class WebpackCLI implements IWebpackCLI {
multiple: false,
description: "Sets process.env.NODE_ENV to the specified value.",
helpLevel: "minimum",
},
}, // Adding more plugins
info-arnav marked this conversation as resolved.
Show resolved Hide resolved
{
name: "define-process-env-node-env",
name: "analyze",
configs: [
{
type: "string",
type: "enum",
values: [true],
},
],
multiple: false,
description:
"Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`).",
helpLevel: "verbose",
description: "It invokes webpack-bundle-analyzer plugin to get bundle information.",
helpLevel: "minimum",
},

// Adding more plugins
{
name: "analyze",
name: "define-process-env-node-env",
configs: [
{
type: "enum",
values: [true],
type: "string",
},
],
multiple: false,
description: "It invokes webpack-bundle-analyzer plugin to get bundle information.",
helpLevel: "minimum",
description:
info-arnav marked this conversation as resolved.
Show resolved Hide resolved
"Sets process.env.NODE_ENV to the specified value. (Currently an alias for `--node-env`).",
helpLevel: "verbose",
},
{
name: "progress",
Expand Down