webpack-split-chunks-analyzer
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -63,7 +63,8 @@ "use strict"; | ||
.map((chunk) => { | ||
const chunkSize = chunk.size(); | ||
const file = Array.from(chunk.files)[0]; | ||
const chunkSize = compilation.assets[file].size(); | ||
const modules = (0, transducist_1.chainFrom)(chunk.getModules()) | ||
.map((mod) => { | ||
const moduleName = typeof mod.userRequest === "string" | ||
? mod.userRequest | ||
? path_1.default.relative(compilation.compiler.context, mod.userRequest) | ||
: // TODO make this a real name | ||
@@ -81,3 +82,3 @@ "<unknown>"; | ||
return { | ||
name: chunk.files.values().next().value, | ||
name: file, | ||
size: chunkSize, | ||
@@ -84,0 +85,0 @@ displaySize: (0, pretty_bytes_1.default)(chunkSize), |
@@ -5,13 +5,19 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const react_1 = tslib_1.__importDefault(require("react")); | ||
const react_1 = tslib_1.__importStar(require("react")); | ||
const react_flow_renderer_1 = tslib_1.__importStar(require("react-flow-renderer")); | ||
const NodeSummary_1 = require("./NodeSummary"); | ||
exports.Graph = react_1.default.memo(function Graph({ graph }) { | ||
return (react_1.default.createElement("div", { style: { height: "100%", width: "100%" } }, | ||
react_1.default.createElement(react_flow_renderer_1.default, { defaultNodes: Object.values(graph.nodes), defaultEdges: graph.edges, fitView: true, snapToGrid: true, nodesConnectable: false, deleteKeyCode: "", onNodeClick: (_evt, node) => { | ||
console.log({ node }); | ||
} }, | ||
react_1.default.createElement(react_flow_renderer_1.Background, { variant: react_flow_renderer_1.BackgroundVariant.Lines, gap: 30, size: 1 }), | ||
react_1.default.createElement(react_flow_renderer_1.MiniMap, null), | ||
react_1.default.createElement(react_flow_renderer_1.Controls, { showInteractive: false })))); | ||
const nodes = (0, react_1.useMemo)(() => Object.values(graph.nodes), [graph.nodes]); | ||
const [nodeData, setNodeData] = (0, react_1.useState)(); | ||
const onNodeClick = (0, react_1.useCallback)((_evt, node) => { | ||
setNodeData(node.data); | ||
}, []); | ||
return (react_1.default.createElement("div", { style: { height: "100%", width: "100%", display: "flex" } }, | ||
react_1.default.createElement("div", { style: { flex: "auto" } }, | ||
react_1.default.createElement(react_flow_renderer_1.default, { defaultNodes: nodes, defaultEdges: graph.edges, fitView: true, snapToGrid: true, nodesConnectable: false, deleteKeyCode: "", onNodeClick: onNodeClick }, | ||
react_1.default.createElement(react_flow_renderer_1.Background, { variant: react_flow_renderer_1.BackgroundVariant.Lines, gap: 30, size: 1 }), | ||
react_1.default.createElement(react_flow_renderer_1.MiniMap, null), | ||
react_1.default.createElement(react_flow_renderer_1.Controls, { showInteractive: false }))), | ||
react_1.default.createElement(NodeSummary_1.NodeSummary, { data: nodeData }))); | ||
}); | ||
//# sourceMappingURL=Graph.js.map |
@@ -13,5 +13,4 @@ "use strict"; | ||
const data = JSON.parse(dataElement.innerHTML); | ||
console.log(data); | ||
(0, react_dom_1.render)(react_1.default.createElement(Graph_1.Graph, { graph: data }), document.getElementById("root")); | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "webpack-split-chunks-analyzer", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Debug how your application is dynamically loaded by webpack", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
368215
61
867