webpackì¼ë¡ ìì¤ ì½ë를 ì»´íì¼ í ë, ì¬ì©ìë 모ëì ëí íµê³ê° í¬í¨ë JSON íì¼ì ìì±í ì ììµëë¤. ì´ë¬í íµê³ë ì í리ì¼ì´ì ì ëíëì ê·¸ëí를 ë¶ìíê³ ì»´íì¼ ìë를 ìµì ííëë° ì¬ì©í ì ììµëë¤. íì¼ì ì¼ë°ì ì¼ë¡ ë¤ì CLI 커맨ëë¡ ìì±ë©ëë¤.
npx webpack --profile --json=compilation-stats.json--json=compilation-stats.json íëê·¸ë ëíëì ê·¸ëí ë° ê¸°í ë¤ìí ë¹ë ì ë³´ê° í¬í¨ë compilation-stats.jsonì ë´ë³´ë´ì¼ í¨ì webpackìê² ëíë
ëë¤. ì¼ë°ì ì¼ë¡, --profile íëê·¸ë ì¶ê°ëì´ ëª¨ëë³ ì»´íì¼ íµê³ê° í¬í¨ë ê° modules ê°ì²´ì profile ì¹ì
ì´ ì¶ê°ë©ëë¤.
ì¶ë ¥ JSON íì¼ì ìµìì 구조ë ë§¤ì° ê°ë¨íì§ë§ ëª ê°ì§ ì¤ì²©ë ë°ì´í° 구조ë ììµëë¤. ê° ì¤ì²© 구조ìë ì´ ë¬¸ì를 ë³´ë¤ ì ì©íê² ì¬ì©í ì ìëë¡ ìëì ì ì© ì¹ì ì´ ììµëë¤. ìëì ìµìì 구조 ë´ì ë§í¬ë¥¼ í´ë¦íë©´ ê´ë ¨ ì¹ì ë° ë¬¸ìë¡ ì´ëí ì ììµëë¤.
{
"version": "5.9.0", // ì»´íì¼ì ì¬ì©ë webpack ë²ì
"hash": "11593e3b3ac85436984a", // ì»´íì¼ í¹ì í´ì
"time": 2469, // ì»´íì¼ ìê° ë°ë¦¬ì´
"publicPath": "auto",
"outputPath": "/", // webpack ì¶ë ¥ ëë í°ë¦¬ ê²½ë¡
"assetsByChunkName": {
// ë´ë³´ë¸ ì ì
매íì ëí ì²í¬ ì´ë¦
"main": ["web.js?h=11593e3b3ac85436984a"],
"named-chunk": ["named-chunk.web.js"],
"other-chunk": ["other-chunk.js", "other-chunk.css"]
},
"assets": [
// [ì ì
ê°ì²´](#asset-objects) 목ë¡
],
"chunks": [
// [ì²í¬ ê°ì²´](#chunk-objects) 목ë¡
],
"modules": [
// [모ë ê°ì²´](#module-objects) 목ë¡
],
"entryPoints": {
// [ìí¸ë¦¬ ê°ì²´](#entry-objects) 목ë¡
},
"errors": [
// [ìë¬ ê°ì²´](#errors-and-warnings) 목ë¡
],
"errorsCount": 0, // ì¤ë¥ ê°ì
"warnings": [
// [ê²½ê³ ê°ì²´](#errors-and-warnings) 목ë¡
],
"warningsCount": 0 // ê²½ê³ ê°ì
}ê° assets ê°ì²´ë ì»´íì¼ìì ë´ë³´ë¸ output íì¼ì ëíë
ëë¤. 모ë ì ì¬í 구조를 ë°ë¦
ëë¤.
{
"chunkNames": [], // ì´ ì ì
ì í¬í¨ë ì²í¬
"chunks": [10, 6], // ì´ ì ì
ì í¬í¨ë ì²í¬ ID
"comparedForEmit": false, // ì ì
ì´ ì¶ë ¥ íì¼ ìì¤í
ì ëì¼í íì¼ê³¼ ë¹êµëìëì§ ì¬ë¶
"emitted": true, // ì ì
ì´ `output` ëë í°ë¦¬ì ëë¬íëì§ ì¬ë¶
"name": "10.web.js", // `output` íì¼ ì´ë¦
"size": 1058, // íì¼ í¬ê¸°(ë°ì´í¸)
"info": {
"immutable": true, // ì ì
ì ì¥ê¸°ê° ìºì í ì ìëì§ ì¬ë¶ë¥¼ ëíë´ë íëê·¸(í´ì í¬í¨)
"size": 1058, // ë°ì´í¸ ë¨ì í¬ê¸°, ì ì
ì ë´ë³´ë¸ ë¤ìë§ ì¬ì© ê°ë¥
"development": true, // ì ì
ì´ ê°ë°ì©ì¼ë¡ë§ ì¬ì©ëê³ ì¬ì©ì ëë©´ ì ì
ì í¬í¨ëì§ ìëì§ ì¬ë¶ë¥¼ ëíë´ë íëê·¸
"hotModuleReplacement": true, // ì ì
ì´ ê¸°ì¡´ ì í리ì¼ì´ì
(HMR) ì
ë°ì´í¸ë¥¼ ìí ë°ì´í°ë¥¼ ì ê³µíëì§ ì¬ë¶ë¥¼ ëíë´ë íëê·¸
"sourceFilename": "originalfile.js", // ì ì
ì´ ìì¤ íì¼ìì ìì±ë ê²½ì°ì sourceFilename(ë³íë ì ìì)
"javascriptModule": true // true, ì ì
ì´ Javascript ë° EMSì¸ ê²½ì°
}
}ê° chunks ê°ì²´ë ì²í¬ë¡ ìë ¤ì§ ëª¨ë 그룹ì ëíë
ëë¤. ê° ê°ì²´ë ë¤ìì 구조를 ë°ë¦
ëë¤.
{
"entry": true, // ì²í¬ì webpack ë°íìì´ í¬í¨ëìëì§ ì¬ë¶
"files": [
// ì´ ì²í¬ë¥¼ í¬í¨íë íì¼ ì´ë¦ 문ìì´ì ë°°ì´
],
"filteredModules": 0, // ìì [top-level structure](#structure) ì¤ëª
ì°¸ê³
"id": 0, // ì´ ì²í¬ì ID
"initial": true, // ì´ ì²í¬ê° ì´ê¸° íì´ì§ ë¡ë ì ë¡ëëëì§ ìëë©´ [on demand](/guides/lazy-loading) ì ë¡ëëëì§ ì¬ë¶
"modules": [
// [모ë ê°ì²´](#module-objects) 목ë¡
"web.js?h=11593e3b3ac85436984a"
],
"names": [
// ì´ ì²í¬ì í¬í¨ë ì²í¬ ì´ë¦ 목ë¡
],
"origins": [
// ìë ì¤ëª
ì°¸ê³ ...
],
"parents": [], // ìì ì²í¬ ID
"rendered": true, // ì²í¬ê° ì½ë ì ëë ì´ì
ì 거쳤ëì§ ì¬ë¶
"size": 188057 // ì²í¬ í¬ê¸°(ë°ì´í¸)
}chunks ê°ì²´ìë 주ì´ì§ ì²í¬ê° ì´ë»ê² ìì±ëìëì§ ì¤ëª
íë origins 목ë¡ë í¬í¨ë©ëë¤. ê° origins ê°ì²´ë ë¤ì ì¤í¤ë§ë¥¼ ë°ë¦
ëë¤.
{
"loc": "", // ì´ ì²í¬ë¥¼ ìì±í ì½ë ë¼ì¸
"module": "(webpack)\\test\\browsertest\\lib\\index.web.js", // 모ë ê²½ë¡
"moduleId": 0, // 모ë ID
"moduleIdentifier": "(webpack)\\test\\browsertest\\lib\\index.web.js", // 모ë ê²½ë¡
"moduleName": "./lib/index.web.js", // 모ëì ëí ìë ê²½ë¡
"name": "main", // ì²í¬ ì´ë¦
"reasons": [
// [module objects](#module-objects)ìì ì°¾ì ëì¼í `reasons` 목ë¡
]
}ì»´íì¼ë ì í리ì¼ì´ì ì ì¤ì 모ëì ëí ì¤ëª ì´ ìì¼ë©´ ì´ë° íµê³ê° ë¬´ì¨ ìë¯¸ê° ìê² ìµëê¹? ìì¡´ì± ê·¸ëíì ê° ëª¨ëì ë¤ì êµ¬ì¡°ë¡ íìë©ëë¤.
{
"assets": [
// [ì ì
ê°ì²´](#asset-objects) 목ë¡
],
"built": true, // 모ëì´ [ë¡ë](/concepts/loaders), íì± ë° ì½ë ì ëë ì´ì
ì 거쳤ìì ì미
"cacheable": true, // 모ëì´ ìºì ê°ë¥íì§ ì¬ë¶
"chunks": [
// 모ëì í¬í¨íë ì²í¬ ID
],
"errors": 0, // 모ëì 리졸ë¸íê±°ë ì²ë¦¬í ë ë°ìí ì¤ë¥ ì
"failed": false, // 모ëìì ì»´íì¼ ì¤í¨ ì¬ë¶
"id": 0, // 모ëì ID ([`module.id`](/api/module-variables/#moduleid-commonjs)ì ì ì¬)
"identifier": "(webpack)\\test\\browsertest\\lib\\index.web.js", // ë´ë¶ì ì¼ë¡ ì¬ì©ëë ê³ ì ID
"name": "./lib/index.web.js", // ì¤ì íì¼ ê²½ë¡
"optional": false, // 모ëì ëí 모ë ìì²ìë `try... catch` ë¸ë¡ì´ ììµëë¤(ESMì ê´ë ¨ ìì)
"prefetched": false, // 모ëì´ [prefetched](/plugins/prefetch-plugin) ëìëì§ ì¬ë¶
"profile": {
// [`--profile` flag](/api/cli/#profiling)ì í´ë¹íë 모ëë³ ì»´íì¼ íµê³ (ë°ë¦¬ì´ ë¨ì)
"building": 73, // ë¡ë ë° íì±
"dependencies": 242, // ìì¡´ì± êµ¬ì¶
"factory": 11 // ìì¡´ì± í´ì
},
"reasons": [
// ìë ì¤ëª
ì°¸ê³ ...
],
"size": 3593, // 모ë ìì í¬ê¸°(ë°ì´í¸)
"source": "// Should not break it...\r\nif(typeof...", // 문ìì´íë ìì ìì¤
"warnings": 0 // 모ëì í´ìíê±°ë ì²ë¦¬í ë ê²½ê³ ì ì
}모ë 모ëìë í´ë¹ 모ëì´ ìì¡´ì± ê·¸ëíì í¬í¨ë ì´ì 를 ì¤ëª
íë reasons ê°ì²´ 목ë¡ë í¬í¨ëì´ ììµëë¤. ê° "reason"ì ìì ì²í¬ ê°ì²´ ì¹ì
ìì 본 originsì ì ì¬í©ëë¤.
{
"loc": "33:24-93", // 모ëì í¬í¨íê² ë§ë ì½ëì ë¼ì¸
"module": "./lib/index.web.js", // [context](/configuration/entry-context/#context) ê¸°ë° ëª¨ëì ìë ê²½ë¡
"moduleId": 0, // 모ë ID
"moduleIdentifier": "(webpack)\\test\\browsertest\\lib\\index.web.js", // 모ë ê²½ë¡
"moduleName": "./lib/index.web.js", // 모ëì ë ì½ê¸° ì¬ì´ ì´ë¦ ("pretty-printing"ì ì¬ì©ë¨)
"type": "require.context", // [type of request](/api/module-methods) ì¬ì©
"userRequest": "../../cases" // `import` ëë `require` ìì²ì ì¬ì©ëë ìì 문ìì´
}"main": {
"name": "main",
"chunks": [
179
],
"assets": [
{
"name": "main.js",
"size": 22
}
],
"filteredAssets": 0,
"assetsSize": 22,
"auxiliaryAssets": [],
"filteredAuxiliaryAssets": 0,
"auxiliaryAssetsSize": 0,
"children": {},
"childAssets": {},
"isOverSizeLimit": false
}errors ë° warnings íë¡í¼í°ìë ê°ê° ê°ì²´ 목ë¡ì´ í¬í¨ëì´ ììµëë¤. ê° ê°ì²´ìë ë©ìì§, ì¤í ì¶ì ë° ë¤ìí íë¡í¼í°ê° í¬í¨ëì´ ììµëë¤.
{
"moduleIdentifier": "C:\\Repos\\webpack\\test\\cases\\context\\issue-5750\\index.js",
"moduleName": "(webpack)/test/cases/context/issue-5750/index.js",
"loc": "3:8-47",
"message": "Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.",
"moduleId": 29595,
"moduleTrace": [
{
"originIdentifier": "C:\\Repos\\webpack\\test\\cases|sync|/^\\.\\/[^/]+\\/[^/]+\\/index\\.js$/",
"originName": "(webpack)/test/cases sync ^\\.\\/[^/]+\\/[^/]+\\/index\\.js$",
"moduleIdentifier": "C:\\Repos\\webpack\\test\\cases\\context\\issue-5750\\index.js",
"moduleName": "(webpack)/test/cases/context/issue-5750/index.js",
"dependencies": [
{
"loc": "./context/issue-5750/index.js"
}
],
"originId": 32582,
"moduleId": 29595
},
{
"originIdentifier": "C:\\Repos\\webpack\\testCases.js",
"originName": "(webpack)/testCases.js",
"moduleIdentifier": "C:\\Repos\\webpack\\test\\cases|sync|/^\\.\\/[^/]+\\/[^/]+\\/index\\.js$/",
"moduleName": "(webpack)/test/cases sync ^\\.\\/[^/]+\\/[^/]+\\/index\\.js$",
"dependencies": [
{
"loc": "1:0-70"
}
],
"originId": 8198,
"moduleId": 32582
}
],
"details": "at RequireContextDependency.getWarnings (C:\\Repos\\webpack\\lib\\dependencies\\ContextDependency.js:79:5)\n at Compilation.reportDependencyErrorsAndWarnings (C:\\Repos\\webpack\\lib\\Compilation.js:1727:24)\n at C:\\Repos\\webpack\\lib\\Compilation.js:1467:10\n at _next2 (<anonymous>:16:1)\n at eval (<anonymous>:42:1)\n at C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2830:7\n at Object.each (C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2850:39)\n at C:\\Repos\\webpack\\lib\\FlagDependencyExportsPlugin.js:219:18\n at C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2830:7\n at Object.each (C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2850:39)\n at C:\\Repos\\webpack\\lib\\FlagDependencyExportsPlugin.js:40:16\n at Hook.eval [as callAsync] (<anonymous>:38:1)\n at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\\Repos\\tapable\\lib\\Hook.js:18:14)\n at Compilation.finish (C:\\Repos\\webpack\\lib\\Compilation.js:1462:28)\n at C:\\Repos\\webpack\\lib\\Compiler.js:909:18\n at processTicksAndRejections (internal/process/task_queues.js:75:11)\n",
"stack": "ModuleDependencyWarning: Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.\n at Compilation.reportDependencyErrorsAndWarnings (C:\\Repos\\webpack\\lib\\Compilation.js:1732:23)\n at C:\\Repos\\webpack\\lib\\Compilation.js:1467:10\n at _next2 (<anonymous>:16:1)\n at eval (<anonymous>:42:1)\n at C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2830:7\n at Object.each (C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2850:39)\n at C:\\Repos\\webpack\\lib\\FlagDependencyExportsPlugin.js:219:18\n at C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2830:7\n at Object.each (C:\\Repos\\webpack\\node_modules\\neo-async\\async.js:2850:39)\n at C:\\Repos\\webpack\\lib\\FlagDependencyExportsPlugin.js:40:16\n at Hook.eval [as callAsync] (<anonymous>:38:1)\n at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\\Repos\\tapable\\lib\\Hook.js:18:14)\n at Compilation.finish (C:\\Repos\\webpack\\lib\\Compilation.js:1462:28)\n at C:\\Repos\\webpack\\lib\\Compiler.js:909:18\n at processTicksAndRejections (internal/process/task_queues.js:75:11)\n"
}