{"id":264645,"date":"2015-08-31T15:33:02","date_gmt":"2015-08-31T11:33:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=264645"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=264645","title":{"rendered":"Webpack \u0434\u043b\u044f Single Page App"},"content":{"rendered":"<br \/>\n<h4>\u041f\u0440\u0438\u0432\u0435\u0442!<\/h4>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/57d\/b1c\/e97\/57db1ce976144a8caedecc3239ba2d99.png\" \/><\/div>\n<p>  \u041e\u0442\u0433\u0440\u0435\u043c\u0435\u043b\u0438 \u0444\u0430\u043d\u0444\u0430\u0440\u044b, \u043f\u0440\u043e\u0448\u0435\u043b \u0437\u0432\u043e\u043d \u0432&nbsp;\u0443\u0448\u0430\u0445 \u043e\u0442&nbsp;\u0438\u0441\u0442\u044f\u0437\u0430\u043d\u0438\u0439 \u00ab\u0435\u0432\u0430\u043d\u0433\u0435\u043b\u0438\u0441\u0442\u043e\u0432\u00bb, \u043c\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0432&nbsp;\u0441\u0444\u0435\u0440\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041a\u0442\u043e-\u0442\u043e \u0443\u0448\u0435\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/sstephenson\/sprockets\">sprockets<\/a>, \u043a\u0442\u043e-\u0442\u043e \u043f\u0443\u0441\u0442\u0438\u043b\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435 \u0438 \u0441\u0442\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b <a href=\"http:\/\/gulpjs.com\/\">gulp<\/a> \u0438\u043b\u0438 <a href=\"http:\/\/gruntjs.com\/\">grunt<\/a>. \u041d\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u2013 \u0441\u0442\u0430\u043b\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0438 \u044d\u0442\u043e \u0444\u0430\u043a\u0442! \u041f\u043e\u0440\u0430 \u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0447\u0435\u043c-\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u043d\u044b\u043c. <\/p>\n<p>  \u0423\u0432\u0435\u0440\u0435\u043d \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e <a href=\"http:\/\/webpack.github.io\/\">webpack<\/a>. \u041a\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u00ab\u043e\u043d&nbsp;\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043d\u0430&nbsp;\u0441\u0435\u0431\u044f \u0431\u0435\u0440\u0435\u0442\u00bb \u0438&nbsp;\u043d\u0435&nbsp;\u0441\u0442\u0430\u043b \u0434\u043e\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0432\u0432\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430&nbsp;\u043e\u0444\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c, \u043d\u043e&nbsp;\u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0432\u0448\u0438\u0441\u044c \u0441&nbsp;\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438&nbsp;&mdash; \u043e\u0442\u0432\u0435\u0440\u0433 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0435\u0448\u0438\u0432 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043b\u0435\u0442. \u041d\u043e&nbsp;\u0432&nbsp;\u0446\u0435\u043b\u043e\u043c, \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432 \u00ab\u0432\u043e\u043a\u0440\u0443\u0433\u00bb \u0445\u043e\u0434\u0438\u0442 \u043c\u0430\u0441\u0441\u0430. \u0412&nbsp;\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435&nbsp;&mdash; \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u0432\u0435\u043d\u0447\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f \u0438&nbsp;\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442 \u043d\u0430&nbsp;\u00ab\u0441\u0432\u0435\u0442\u043b\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443\u00bb. \u0412\u043e\u043e\u0431\u0449\u0435\u043c \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n<p>  <a name=\"habracut\"><\/a> <\/p>\n<p>  \u0427\u0435\u0441\u0442\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u044d\u0442\u0438\u043c \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u044f \u043d\u0430\u0447\u0430\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0433\u043e\u0434\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u201cwow\u201d \u044d\u0444\u0444\u0435\u043a\u0442. \u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0441\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0431\u043e\u043b\u044c\u044e \u043e\u0442 \u0436\u0443\u0442\u043a\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438. \u041d\u043e \u043f\u0435\u0440\u0435\u0441\u0438\u043b\u0438\u0432 \u044d\u0442\u043e\u0442 \u044d\u0442\u0430\u043f \u2013 \u0447\u0435\u0441\u0442\u043d\u043e \u0437\u0430\u0431\u044b\u043b \u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445, \u0431\u044b\u043b \u043f\u043e\u0440\u0430\u0436\u0435\u043d \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0438 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e\u043c. \u041d\u0435 \u0431\u0443\u0434\u0443 \u0443\u0442\u043e\u043c\u043b\u044f\u0442\u044c, \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441\u2026<\/p>\n<h4>\u041c\u0435\u0445\u0430\u043d\u0438\u043a\u0430<\/h4>\n<p>  \u041b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043d\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f<br \/>  Webpack \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432, \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 (entry points) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0443\u0442\u0438 \u0438\u0437 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u0434\u0430\u043b\u0435\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0435\u0433\u043e. <\/p>\n<p>  \u0421\u0431\u043e\u0440\u0449\u0438\u043a \u2013 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u0443\u044e \u0435\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <b>require()<\/b> \u2013 \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442. <br \/>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e \u00ab\u0433\u043e\u043d\u043a\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438\u00bb. \u0412\u0441\u0435 \u0447\u0442\u043e \u0432\u044b \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0435, \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u043d\u0443\u0436\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438!<\/p>\n<p>  \u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0449\u0435\u043d <b>webpack-dev-server<\/b> \u2013\u00a0\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b <b>(chunks)<\/b> \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c RAM. \u0411\u0440\u0430\u0443\u0437\u0435\u0440 \u0436\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0445 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 <b>webpack:\/\/<\/b> \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. <br \/>  \u0422\u0430\u043a \u0436\u0435 <b>dev-server<\/b> \u2013 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0432\u0435\u0431 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043f\u043e\u0440\u0442 8080, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <b><i>localhost:8080<\/i><\/b><\/p>\n<p>  \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c, \u043a\u0430\u043a \u0412\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438, \u043d\u0430 \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u043a\u0443\u043d\u0434. \u0427\u0442\u043e \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0434\u043d\u044f \u2013 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u0443\u0439\u043c\u0443 \u0412\u0430\u0448\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438, \u0442\u043e webpack \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043b\u0438\u0448\u044c \u044d\u0442\u0430\u043f, \u043a\u043e\u0433\u0434\u0430 \u0444\u0430\u0439\u043b\u044b \u0440\u0430\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u0430\u043f\u043a\u0430\u043c \u0432 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0412\u0430\u0448\u0435 \u0431\u043b\u0430\u0433\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/312\/baa\/19d\/312baa19d81e43a58116e1f357b894e3.png\" alt=\"image\"\/><br \/>  <i>source: jlongster.com\/Backend-Apps-with-Webpack&#8212;Part-III<\/i><\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0422\u0443\u0442 \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e. \u0412\u0441\u0435 \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u043e <a href=\"https:\/\/nodejs.org\/\">node.js<\/a> \u0438 <a href=\"https:\/\/www.npmjs.com\/\">npm<\/a>. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c:<\/p>\n<pre><code class=\"bash\">$ mkdir app $ cd $_  $ npm init & npm i webpack webpack-dev-server --save-dev # \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 dev dependencies <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0431\u044b \u044d\u0442\u043e \u043d\u0435 \u0437\u0432\u0443\u0447\u0430\u043b\u043e, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b \u0412\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. <br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0412\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c \u0438 \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0423\u0441\u043b\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c:  <\/p>\n<ul>\n<li>Common JS<\/li>\n<li>Stylus<\/li>\n<li>Jade<\/li>\n<li>Autoprefixer<\/li>\n<\/ul>\n<p>  \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<h4>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h4>\n<p>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, webpack \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON. \u041d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f <b>webpack.config.js<\/b><\/p>\n<p>  \u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0437\u0430\u0434\u0430\u0447, \u0430 \u0438\u0445 \u0431\u0443\u0434\u0435\u0442 \u0434\u0432\u0435:  <\/p>\n<ul>\n<li><b>\u0421\u0431\u043e\u0440\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/b><\/li>\n<li><b>\u0420\u0435\u0436\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/b><\/li>\n<\/ul>\n<p>  \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <b><i>script<\/i><\/b> \u0441\u0435\u043a\u0446\u0438\u0435\u0439 package.json \u0444\u0430\u0439\u043b\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438:<\/p>\n<pre><code>&quot;scripts&quot;: {   &quot;dev&quot;: &quot;NODE_ENV=development webpack-dev-server --progress&quot;,   &quot;build&quot;: &quot;NODE_ENV=production webpack --progress&quot; } <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u0445\u043e\u0434\u044f\u0441\u044c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0412\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">$ npm run dev # \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 http:\/\/localhost:8080 $ npm run build # \u0441\u0431\u043e\u0440\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0430\u0441\u0441\u0435\u0442\u043e\u0432 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 .\/dist <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0433\u0438\u0435\u0439:  <\/p>\n<pre><code class=\"bash\">$ touch webpack.config.js # \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 webpack $ mkdir config # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438 $ cd $_ # \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c $ touch global.js # \u043e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u043e\u0432 \u0438 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 $ mkdir env && cd $_ $ touch development.js # \u0444\u0430\u0439\u043b \u0441 '\u0442\u043e\u043d\u043a\u043e\u0439' \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 webpack \u0434\u043b\u044f \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 $ touch production.js # \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b <b>.\/webpack.config.js<\/b> \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:  <\/p>\n<pre><code class=\"javascript\">'use strict';  var _ = require('lodash'); var _configs = {   global: require(__dirname + '\/config\/global'),   production: require(__dirname + '\/config\/env\/production'),   development: require(__dirname + '\/config\/env\/development') };  var _load = function(environment) {   \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435   if (!environment) throw 'Can\\'t find local environment variable via process.env.NODE_ENV';   if (!_configs[environment]) throw 'Can\\'t find environments see _config object';    \/\/ load config file by environment   return _configs && _.merge(     _configs[environment](__dirname),     _configs['global'](__dirname)   ); };  \/**  * Export WebPack config  * @type {[type]}  *\/ module.exports = _load(process.env.NODE_ENV);  <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 <a href=\"https:\/\/lodash.com\/\">lodash<\/a>, \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:  <\/p>\n<pre><code class=\"bash\">$ npm i lodash --save-dev <\/code><\/pre>\n<p>  \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0445\u0438\u0442\u0440\u0438\u0432, \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 <i><b>merge<\/b><\/i> \u2013 \u0431\u0438\u0431\u043b\u0438\u0442\u0435\u043a\u0438 lodash, &#8216;\u0441\u043a\u043b\u0435\u0438\u0442\u044c&#8217; \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e 2 \u0444\u0430\u0439\u043b\u0430. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044f <a href=\"https:\/\/nodejs.org\/api\/process.html#process_process_env\">process.env<\/a>.<\/p>\n<h4><b>.\/config\/global.js<\/b><\/h4>\n<p>  \u0424\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <s>\u043d\u0435\u043d\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043b\u0435\u043a\u0441\u0438\u043a\u0443<\/s> \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0431\u043e\u0440\u0449\u0438\u043a\u0430, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043a \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043d\u0435\u0441\u0442\u0438\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:<\/p>\n<pre><code class=\"javascript\">'use strict'  var path        = require('path'); var webpack     = require('webpack'); var Manifest    = require('manifest-revision-webpack-plugin'); var TextPlugin  = require('extract-text-webpack-plugin'); var HtmlPlugin    = require('html-webpack-plugin');  module.exports = function(_path) {    \/\/define local variables   var dependencies  = Object.keys(require(_path + '\/package').dependencies);   var rootAssetPath = _path + 'app';    return {     \/\/ \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430     entry: {       application: _path + '\/app\/app.js',       vendors: dependencies     },      \/\/ \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435     output: {       path: path.join(_path, 'dist'),       filename: path.join('assets', 'js', '[name].bundle.[chunkhash].js'),       chunkFilename: '[id].bundle.[chunkhash].js',       publicPath: '\/'     },      \/\/ \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0442\u0435\u043c, \u0433\u0434\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438     resolve: {       extensions: ['', '.js'],       modulesDirectories: ['node_modules'],       \/\/ \u0410\u043b\u0438\u0430\u0441\u044b - \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 ex. require('_modules\/test\/index')       alias: {         _svg:         path.join(_path, 'app', 'assets', 'svg'),         _data:        path.join(_path, 'app', 'data'),         _fonts:       path.join(_path, 'app', 'assets', 'fonts'),         _modules:     path.join(_path, 'app', 'modules'),         _images:      path.join(_path, 'app', 'assets', 'images'),         _stylesheets: path.join(_path, 'app', 'assets', 'stylesheets'),         _templates:   path.join(_path, 'app', 'assets', 'templates')       }     },     \/\/ \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u043e\u0432, \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0440\u043e\u043b\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439     module: {       loaders: [         { test: \/\\.jade$\/, loader: 'jade-loader' },         { test: \/\\.(css|ttf|eot|woff|woff2|png|ico|jpg|jpeg|gif|svg)$\/i, loaders: ['file?context=' + rootAssetPath + '&name=assets\/static\/[ext]\/[name].[hash].[ext]'] },         { test: \/\\.styl$\/, loader: TextPlugin.extract('style-loader', 'css-loader!autoprefixer-loader?browsers=last 5 version!stylus-loader') }       ]     },      \/\/ \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d\u044b     plugins: [       new webpack.optimize.CommonsChunkPlugin('vendors', 'assets\/js\/vendors.[hash].js'),       new TextPlugin('assets\/css\/[name].[hash].css'),       new Manifest(path.join(_path + '\/config', 'manifest.json'), {         rootAssetPath: rootAssetPath       }),       \/\/ \u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0431\u0443\u0434\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f &quot;\u043a\u043e\u0440\u043d\u0435\u0432\u044b\u043c&quot; index.html       new HtmlPlugin({         title: 'Test APP',         chunks: ['application', 'vendors'],         filename: 'index.html',         template: path.join(_path, 'app', 'index.html')       })     ]   } }; <\/code><\/pre>\n<p>  <b>\u0410\u0442\u0442\u0435\u043d\u0448\u0435\u043d \u0433\u043e\u0441\u043f\u043e\u0434\u0430!<\/b><br \/>  \u041f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u2013\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">$ npm i path manifest-revision-webpack-plugin extract-text-webpack-plugin html-webpack-plugin --save-dev <\/code><\/pre>\n<h4>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h4>\n<p>  \u041c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0431 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043a\u043e\u043d\u0444\u0438\u0433 \u0440\u0435\u0436\u0438\u043c\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u2013 \u0441\u0442\u0430\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"javascript\">'use strict';  \/**  * Development config  *\/ module.exports = function(_path) {    return {     context: _path,     debug: true,     devtool: 'eval',     devServer: {       contentBase: '.\/dist',       info: true,       hot: false,       inline: true     }   } }; <\/code><\/pre>\n<h4>\u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430<\/h4>\n<p>  \u0410 \u0432\u043e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432 \u0441\u0442\u0430\u0434\u0438\u0438 \u00ab\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439\u00bb. \u0425\u043e\u0442\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 5+<\/p>\n<pre><code class=\"javascript\">'use strict';  \/**  * Production config  *\/ module.exports = function(_path) {   return {     context: _path,     debug: false,     devtool: 'cheap-source-map',     output: {       publicPath: '\/'     }   } } <\/code><\/pre>\n<h4>index.html<\/h4>\n<p>  \u042d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d, \u043c\u044b \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 <b>.\/app\/index.html<\/b> \u2013 \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0434\u043e \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u043a\u0438, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html{% if(o.htmlWebpackPlugin.files.manifest) { %} manifest=&quot;{%= o.htmlWebpackPlugin.files.manifest %}&quot;{% } %}&gt;   &lt;head&gt;     &lt;meta charset=&quot;UTF-8&quot;&gt;     &lt;title&gt;{%=o.htmlWebpackPlugin.options.title || 'Webpack App'%}&lt;\/title&gt;     {% for (var css in o.htmlWebpackPlugin.files.css) { %}       &lt;link href=&quot;{%=o.htmlWebpackPlugin.files.css[css] %}&quot; rel=&quot;stylesheet&quot;&gt;     {% } %}   &lt;\/head&gt;   &lt;body&gt;     {% for (var chunk in o.htmlWebpackPlugin.files.chunks) { %}     &lt;script src=&quot;{%=o.htmlWebpackPlugin.files.chunks[chunk].entry %}&quot;&gt;&lt;\/script&gt;     {% } %}   &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<h4>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438<\/h4>\n<p>  \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 webpack \u0437\u0430 \u0441\u0442\u043e\u043b\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. <br \/>  \u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0440\u0430\u0436\u0430\u0435\u0442, \u0434\u0430\u0436\u0435 \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. <\/p>\n<p>  \u0410\u0445, \u0434\u0430. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0432 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <b>underscore<\/b> \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0439 npm \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439  <\/p>\n<pre><code class=\"bash\">$ npm i underscore --save <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432 dependencies \u2013 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e webpack, \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0444\u0430\u0439\u043b vendors.[hash].js \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0445\u0435\u0448\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u043e\u0442 md5 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 + \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u0430\u0434\u043e, \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443.<br \/>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435, \u043f\u0438\u0448\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b.<br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e.<\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p>  <a href=\"https:\/\/github.com\/rambler-digital-solutions\/rambler-webpack-boilerplate\">\u0422\u0443\u0442<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435<br \/>  \u0410 <a href=\"https:\/\/webpack.github.io\/\">\u0442\u0443\u0442<\/a> \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443<br \/>  \u041d\u0443 \u0438 \u0442\u0443\u0442 <a href=\"http:\/\/jlongster.com\/Backend-Apps-with-Webpack--Part-III\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/265801\/\"> http:\/\/habrahabr.ru\/post\/265801\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<br \/>\n<h4>\u041f\u0440\u0438\u0432\u0435\u0442!<\/h4>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/57d\/b1c\/e97\/57db1ce976144a8caedecc3239ba2d99.png\" \/><\/div>\n<p>  \u041e\u0442\u0433\u0440\u0435\u043c\u0435\u043b\u0438 \u0444\u0430\u043d\u0444\u0430\u0440\u044b, \u043f\u0440\u043e\u0448\u0435\u043b \u0437\u0432\u043e\u043d \u0432&nbsp;\u0443\u0448\u0430\u0445 \u043e\u0442&nbsp;\u0438\u0441\u0442\u044f\u0437\u0430\u043d\u0438\u0439 \u00ab\u0435\u0432\u0430\u043d\u0433\u0435\u043b\u0438\u0441\u0442\u043e\u0432\u00bb, \u043c\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0432&nbsp;\u0441\u0444\u0435\u0440\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041a\u0442\u043e-\u0442\u043e \u0443\u0448\u0435\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/sstephenson\/sprockets\">sprockets<\/a>, \u043a\u0442\u043e-\u0442\u043e \u043f\u0443\u0441\u0442\u0438\u043b\u0441\u044f \u0432\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435 \u0438 \u0441\u0442\u0430\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u044b \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b <a href=\"http:\/\/gulpjs.com\/\">gulp<\/a> \u0438\u043b\u0438 <a href=\"http:\/\/gruntjs.com\/\">grunt<\/a>. \u041d\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u0431\u043e\u0440\u043a\u0438 \u2013 \u0441\u0442\u0430\u043b\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0438 \u044d\u0442\u043e \u0444\u0430\u043a\u0442! \u041f\u043e\u0440\u0430 \u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0447\u0435\u043c-\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u043d\u044b\u043c. <\/p>\n<p>  \u0423\u0432\u0435\u0440\u0435\u043d \u043c\u043d\u043e\u0433\u0438\u0435 \u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u043e <a href=\"http:\/\/webpack.github.io\/\">webpack<\/a>. \u041a\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u00ab\u043e\u043d&nbsp;\u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043d\u0430&nbsp;\u0441\u0435\u0431\u044f \u0431\u0435\u0440\u0435\u0442\u00bb \u0438&nbsp;\u043d\u0435&nbsp;\u0441\u0442\u0430\u043b \u0434\u043e\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0432\u0432\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430&nbsp;\u043e\u0444\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c, \u043d\u043e&nbsp;\u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0432\u0448\u0438\u0441\u044c \u0441&nbsp;\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438&nbsp;&mdash; \u043e\u0442\u0432\u0435\u0440\u0433 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0440\u0435\u0448\u0438\u0432 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043b\u0435\u0442. \u041d\u043e&nbsp;\u0432&nbsp;\u0446\u0435\u043b\u043e\u043c, \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043e\u0432 \u00ab\u0432\u043e\u043a\u0440\u0443\u0433\u00bb \u0445\u043e\u0434\u0438\u0442 \u043c\u0430\u0441\u0441\u0430. \u0412&nbsp;\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435&nbsp;&mdash; \u0445\u043e\u0447\u0443 \u0440\u0430\u0437\u0432\u0435\u043d\u0447\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043a\u0442\u043e-\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f \u0438&nbsp;\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442 \u043d\u0430&nbsp;\u00ab\u0441\u0432\u0435\u0442\u043b\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443\u00bb. \u0412\u043e\u043e\u0431\u0449\u0435\u043c \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-264645","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=264645"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/264645\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=264645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=264645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=264645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}