{"id":275087,"date":"2016-02-28T16:58:02","date_gmt":"2016-02-28T13:58:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=275087"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=275087","title":{"rendered":"\u0418\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u043c Webpack \u0432 Visual Studio 2015"},"content":{"rendered":"\n<div style=\"text-align:center;\"><img decoding=\"async\"  alt=\"Webpack + VS\" src=\"https:\/\/habrastorage.org\/files\/805\/5f4\/9cd\/8055f49cd197434cb92e0b4c1e1e6630.png\" width=\"800\"\/><\/div>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 webpack \u0438\u0437 Visual Studio \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a webpack \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0431\u0430\u043d\u0434\u043b\u0438\u043d\u0433 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h1>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h1>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c webpack, \u0435\u0441\u043b\u0438 \u043e\u043d \u0443 \u0432\u0430\u0441 \u0435\u0449\u0435 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d.<\/p>\n<pre><code>npm install webpack babel-loader babel-core --save-dev<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <a href=\"https:\/\/visualstudiogallery.msdn.microsoft.com\/5497fd10-b1ba-474c-8991-1438ae47012a\">Webpack Task Runner<\/a> (Tools -&gt; Extensions &amp; Updates).<\/p>\n<h1>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/h1>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 Visual Studio \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d WebPack Configuration File. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0d9\/6ea\/438\/0d96ea4380b64e67ae08a611eee1e06e.PNG\" alt=\"Webpack Template\"\/><br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0433\u043e \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  \u0428\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 <code>webpack.config.js<\/code> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>&quot;use strict&quot;;  module.exports = {     entry: &quot;.\/src\/file.js&quot;,     output: {         filename: &quot;.\/dist\/bundle.js&quot;     },     devServer: {         contentBase: &quot;.&quot;,         host: &quot;localhost&quot;,         port: 9000     },     module: {         loaders: [             {                 test: \/\\.jsx?$\/,                 loader: &quot;babel-loader&quot;             }         ]     } };<\/code><\/pre>\n<p>  \u0412 <code>entry<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e js \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 <code>output<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u0443\u0434\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0431\u0430\u043d\u0434\u043b.<br \/>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446), \u0442\u043e \u0432 <code>entry<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code>    entry: {         file1: &quot;.\/src\/file1.js&quot;,         file2: &quot;.\/src\/file2.js&quot;         }<\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u043d\u0434\u043b\u043e\u0432 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u043e\u043b\u0435 <code>output<\/code>.<\/p>\n<pre><code>    output: {         path: path.join(__dirname, &quot;.\/dist&quot;),         filename: &quot;[name].js&quot;     }<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0432\u0430 \u0431\u0430\u043d\u0434\u043b\u0430: <code>file1.js<\/code> \u0438 <code>file2.js<\/code>.<\/p>\n<p>  \u0411\u0430\u0437\u043e\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c <code>Run-Development<\/code> \u0438\u0437 Task Runner.<\/p>\n<p>  <img decoding=\"async\" alt=\"Webpack task-runner\" src=\"https:\/\/habrastorage.org\/files\/11f\/e69\/e5e\/11fe69e5e0ab49c0ad0f31f227129293.PNG\"\/><br \/>  \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c <code>Run-Development<\/code> \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e, \u043c\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c webpack \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0440\u0435\u0436\u0438\u043c <code>--watch<\/code>. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c webpack \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0431\u0443\u0434\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <\/p>\n<p>  <code>\/\/\/ &lt;binding ProjectOpened='Watch - Development' \/&gt;<\/code> <\/p>\n<p>  \u0432 \u043d\u0430\u0447\u0430\u043b\u043e <code>webpack.config.js<\/code> \u0438 \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e. \u0414\u0430, \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e! <\/p>\n<h1>\u041e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0441\u0431\u043e\u0440\u043a\u0438<\/h1>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0441\u0431\u043e\u0440\u043a\u0438. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.npmjs.com\/package\/webpack-notifier\">WebpackNotifierPlugin<\/a>.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>  <code>npm install --save-dev webpack-notifier<\/code><\/p>\n<p>  \u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 <code>webpack.config.js<\/code> \u0444\u0430\u0439\u043b <\/p>\n<pre><code>var WebpackNotifierPlugin = require('webpack-notifier');  module.exports = {     \/\/ ...      plugins: [       new WebpackNotifierPlugin()      ] };<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0443\u0434\u0430\u0447\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435, \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/317\/41c\/f17\/31741cf17c8e450aa1fabeb4cdde0c23.PNG\" alt=\"Success build\" width=\"400\"\/><\/div>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435. \u0423 webpack \u0435\u0441\u0442\u044c \u0435\u0449\u0435 live-reloading \u0438 profiling, \u0438\u0445 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437.<br \/>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.                 <\/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=\"https:\/\/habrahabr.ru\/post\/278103\/\"> https:\/\/habrahabr.ru\/post\/278103\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div style=\"text-align:center;\"><img decoding=\"async\"  alt=\"Webpack + VS\" src=\"https:\/\/habrastorage.org\/files\/805\/5f4\/9cd\/8055f49cd197434cb92e0b4c1e1e6630.png\" width=\"800\"\/><\/div>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 webpack \u0438\u0437 Visual Studio \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e: \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a webpack \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0431\u0430\u043d\u0434\u043b\u0438\u043d\u0433 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u0435.   <\/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-275087","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275087","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=275087"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/275087\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=275087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=275087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=275087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}