{"id":315833,"date":"2020-12-30T21:00:24","date_gmt":"2020-12-30T21:00:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=315833"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=315833","title":{"rendered":"TypeScript \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 WebPack (FE and BE)"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5b2\/7cf\/946\/5b27cf946f5fc9ea4b1ed837b3df503f.png\" width=\"1200\" height=\"628\"><figcaption><\/figcaption><\/figure>\n<h3>\u041b\u0435\u0433\u0435\u043d\u0434\u0430<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u0437\u0430\u0440\u043e\u0434\u0438\u043b\u0441\u044f, \u0442\u043e \u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043a\u0430\u0436\u0434\u043e\u043c\u0443. \u0411\u0435\u043b\u044b\u0439 \u043b\u0438\u0441\u0442\u0430 \u0431\u0443\u043c\u0430\u0433\u0438 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u043d\u0435\u0433\u043e \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0438 \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0430\u043b \u043a\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043e\u0442\u043a\u0440\u043e\u044e\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0435\u0448\u0430\u0442\u0441\u044f. <\/p>\n<p>\u0412\u043e\u0442 \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043d\u0435\u0441 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u043b\u043e\u043a. \u0421\u0437\u0430\u0434\u0438 \u0440\u0430\u0437\u0434\u0430\u043b\u0430\u0441\u044c \u0440\u0443\u0433\u0430\u043d\u044c. \u042d\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0441\u043f\u043e\u0440\u0438\u043b\u0438: \u041a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u0440\u0442\u0435\u0440 \u0432\u044b\u0431\u0440\u0430\u0442\u044c. \u0423 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u043e \u0441\u043f\u0438\u043d\u0435 \u043f\u0440\u043e\u043d\u0435\u0441\u0441\u044f \u0445\u043e\u043b\u043e\u0434\u043e\u043a. \u041d\u0435 \u0443\u0441\u043f\u0435\u043b\u0430 \u0441\u043b\u043e\u0436\u0438\u043b\u0430\u0441\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f Proof Of Concept, \u043d\u0435 \u0442\u043e \u0447\u0442\u043e \u0434\u043b\u044f Minimal Valuable Product, \u043d\u043e \u0443\u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f. \u0412\u044b\u0431\u043e\u0440 \u0441\u0442\u0430\u0440\u0442\u0435\u0440\u0430 \u043d\u0430\u043b\u043e\u0436\u0438\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0431\u044b\u043b\u043e \u044f\u0441\u043d\u043e, \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043f\u043e\u0434\u043e\u0448\u0435\u043b \u043a Team Lead \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebPack \u0438 \u0447\u0438\u0441\u0442\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0435\u0437 \u0441\u0442\u0430\u0440\u0442\u0435\u0440\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e \u043f\u0440\u043e\u0448\u043b\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c \u0441 \u043d\u0438\u043c \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<h3>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0442\u043e \u0432 2020 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u0440\u0430\u0443\u0437\u0435\u0440 &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0441\u0431\u043e\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e WebPack.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043b\u0438 \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u043d\u0443\u0436\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 create-react-app.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447 \u043c\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435\u0442. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0430\u043c\u0438 \u043e\u0442\u043b\u043e\u0436\u0430\u0442\u0441\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435.<\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0438 loader&#8217;s \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443, \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 95% \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u0430\u0436\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f. \u041c\u0430\u043b\u043e \u043a\u0442\u043e \u0441\u0445\u043e\u0434\u0443 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442 <code>devtool<\/code> \u0438\u043b\u0438 <code>devtools<\/code>. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u043b\u0438\u0441\u044c \u043a \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 WebPack. \u0423\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043f\u043b\u0435\u0447\u0438 TypeScript.<\/p>\n<p>\u041f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043c\u043d\u0435 \u043d\u0435 \u043d\u0430\u0445\u0432\u0430\u0442\u0430\u043b\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0441\u0430\u043c\u043e\u0433\u043e WebPack \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435: <a href=\"https:\/\/webpack.js.org\/configuration\/configuration-languages\/#typescript\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0441\u0441\u044b\u043b\u043a\u0430<\/a>.<\/p>\n<h3>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435<\/h3>\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u0442 \u0446\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435\u043e\u0431\u044a\u0435\u043c\u043b\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0443\u0430\u043b \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435, \u0431\u0443\u0434\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f backend \u0438 frontend.<\/p>\n<p>C\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 FE \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430. \u0421\u0430\u043c \u0436\u0435 FE \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <code>Hello World!<\/code>. \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043b\u044f BE \u0431\u0443\u0434\u0435\u0442 <code>node<\/code>, \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 <code>webpack<\/code>.<\/p>\n<p>GitHub: <a href=\"https:\/\/github.com\/shaltaev\/webpack-with-config-on-typescript\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043d\u043e-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 server \u0438 web<em>app \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/em><\/p>\n<ul>\n<li>\n<p><em>~\/project<\/em>folder\/   # \u041a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>yarn init<\/code><\/p>\n<ul>\n<li>\n<p>\/apps  # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/p>\n<ul>\n<li>\n<p>\/server  # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f backend &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>yarn init<\/code><\/p>\n<ul>\n<li>\n<p>\/src # \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u0447\u0430\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a BE)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\/web<em>app  # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f frontend &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <\/em><code>yarn init<\/code><\/p>\n<ul>\n<li>\n<p><em>\/src # \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/em><\/p>\n<\/li>\n<li>\n<p><em>\u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u0447\u0430\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a FE)<\/em><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><em>\/<\/em>utils  # \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043e\u0431\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0449\u0438\u0435 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>~\/project_folder<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code>yarn add -D @types\/node @types\/webpack concurrently cross-env nodemon ts-loader ts-node typescript webpack webpack-cli<\/code><\/pre>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>\/apps\/server<\/code> \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u0445 \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u043e\u0431\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>\/apps\/web_app<\/code> \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <code>html-webpack-plugin<\/code> 5 \u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441 WebPack 5 \u0432\u0435\u0440\u0441\u0438\u0438. \u041d\u0430 \u041c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0442 \u043f\u043e\u043a\u0435\u0442 \u0435\u0449\u0435 \u0432 beta \u0434\u043e\u0441\u0442\u0443\u043f\u0435.<\/p>\n<\/li>\n<\/ul>\n<pre><code>cd apps\/web_app yarn add -D html-webpack-plugin@5<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TypeScript<\/h3>\n<p>\u0411\u0440\u0430\u0443\u0437\u0435\u0440, server, \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 runner &#8212; \u044d\u0442\u043e \u0442\u0440\u0438 \u0441\u0440\u0435\u0434\u044b \u0441 \u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/p>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, node&nbsp;\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0427\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:&nbsp;<a href=\"https:\/\/node.green\" rel=\"noopener noreferrer nofollow\">https:\/\/node.green<\/a><\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <code>apps\/server\/tsconfig.json<\/code> \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0443, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 webpack \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043d\u0430 \u043a\u043e\u043d\u0435\u0446 2020, \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c&nbsp;ES6&nbsp;\u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c Internet Explorer 11. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: <a href=\"https:\/\/caniuse.com\" rel=\"noopener noreferrer nofollow\">https:\/\/caniuse.com<\/a><\/p>\n<p> \u0424\u0430\u0439\u043b: <code>apps\/web_app\/tsconfig.json<\/code><\/p>\n<p>\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 runner \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0442\u043e\u0436\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439 \u043b\u0435\u0433\u043a\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u044b. \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f TS, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>ts-node<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c webpack. <\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p>tsconfig.json<\/p>\n<pre><code>\"compilerOptions\": {     \"module\": \"commonjs\",     \"target\": \"es5\",     \"esModuleInterop\": true   }<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0438 \u0447\u0430\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0430\u043c\u043e\u0433\u043e webpack \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 typescript<\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442, \u0440\u0430\u0437\u0434\u0430\u0447\u0435\u0439 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438. \u041a\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 (<a href=\"https:\/\/nodejs.org\/en\/knowledge\/HTTP\/servers\/how-to-serve-static-files\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>) \u0441 \u0441\u0430\u0439\u0442\u0430 node, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u043f\u0430\u043f\u043a\u0430\u043c <code>..\\..\\secret<\/code> \u0432 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p>apps\/server\/src\/index.ts<\/p>\n<pre><code class=\"javascript\">import { resolve, normalize, join } from 'path' import { createServer, RequestListener} from 'http' import { readFile } from 'fs'   const webAppBasePath = '..\/web_app'; \/\/ \u042d\u0442\u043e \u043f\u0443\u0442\u044c \u0434\u043e \u043f\u0430\u043f\u043a\u0438 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 build (\u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 dist)  const handleWebApp: RequestListener = (req, res) =&gt; {     const resolvedBase = resolve(__dirname ,webAppBasePath);     const safeSuffix = normalize(req.url || '')         .replace(\/^(\\.\\.[\\\/\\\\])+\/, '');     const fileLocation = join(resolvedBase, safeSuffix);      readFile(fileLocation, function(err, data) {         if (err) {             res.writeHead(404, 'Not Found');             res.write('404: File Not Found!');             return res.end();         }          res.statusCode = 200;          res.write(data);         return res.end();     });  };  const httpServer = createServer(handleWebApp)  httpServer.listen(\"5000\", () =&gt; {     console.info('Listen on 5000 port') })<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>Frontend \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>Web \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435. \u0412 <code>document.body<\/code> \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <code>&amp;lt;div id=\"root\"&gt;Hello world!&amp;lt;\/div&gt;<\/code><\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p>apps\/web<em>app\/src\/index.ts<\/em><\/p>\n<pre><code>const rootNode = document.createElement('div') rootNode.setAttribute('id', 'root') rootNode.innerText = 'Hello World!'  document.body.appendChild(rootNode)<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 WebPack<\/h3>\n<p><em>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c webpack.<\/em><\/p>\n<p><em>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u044b. \u0410 \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c TS, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <\/em><code>import {serverConfig} from \".\/apps\/server\/webpack.part\";<\/code> \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>webpack.config.ts<\/em><\/p>\n<pre><code>import {serverConfig} from \".\/apps\/server\/webpack.part\"; import {webAppConfig} from \".\/apps\/web_app\/webpack.part\"; import {commonConfig} from \".\/webpack.common\";  export default [     \/** server  **\/ {...commonConfig, ...serverConfig},     \/** web_app **\/ {...commonConfig, ...webAppConfig}, ]<\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u0412 \u043d\u0435\u043c \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u0441 \u043e\u0431\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u044c\u044e.<\/em><\/p>\n<p><em>\u041e\u0431\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/em><\/p>\n<p><em>\u041e\u0431\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u043e\u043b\u044f <\/em><code>mode<\/code> \u0438 <code>resolve<\/code>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0443 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f <code>const commonConfig: Configuration<\/code>, \u0442\u0438\u043f \u0432\u0437\u044f\u0442 \u0438\u0437 <code>import {Configuration} from \"webpack\";<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>webpack.common.ts<\/em><\/p>\n<pre><code>import {Configuration, RuleSetRule} from \"webpack\"; import {isDev} from \".\/apps\/_utils\";  export const tsRuleBase: RuleSetRule = {     test: \/\\.ts$\/i,     loader: 'ts-loader', }  export const commonConfig: Configuration = {     mode: isDev ? 'development' : 'production',     resolve: {         extensions: ['.tsx', '.ts', '.js', '.json'],     }, } <\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043b\u0435\u0436\u0438\u0442 \u043e\u0431\u0449\u0430\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 TS \u0444\u0430\u0439\u043b\u043e\u0432 <\/em><code>const tsRuleBase: RuleSetRule<\/code>, \u0442\u0438\u043f \u0432\u0437\u044f\u0442 \u0438\u0437 <code>import {RuleSetRule} from \"webpack\";<\/code>.<\/p>\n<p><code>isDev<\/code> \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <code>isDev = process.env.NODE_ENV === 'development'<\/code> <\/p>\n<p><em>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f FE \u0438 BE<\/em><\/p>\n<p><em>\u0422\u0443\u0442 \u0443\u0436\u0435 \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 webpack, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430\u043c\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 <\/em><code>import {Configuration, RuleSetRule, WebpackPluginInstance} from \"webpack\";<\/code><\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <\/em><code>WatchIgnorePlugin<\/code> \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 \u043d\u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>apps\/server\/webpack.part.ts<\/em><\/p>\n<pre><code>import {Configuration, RuleSetRule, WatchIgnorePlugin, WebpackPluginInstance} from \"webpack\"; import {join} from \"path\"; import {tsRuleBase} from \"..\/..\/webpack.common\";  const serverPlugins: WebpackPluginInstance[] = [     new WatchIgnorePlugin({         paths: [join(__dirname, '..', 'apps', 'web_app')]     }) ] const tsRuleServer: RuleSetRule = {     ...tsRuleBase,     options: {         configFile: join(__dirname, 'tsconfig.json')     } } export const serverConfig: Configuration = {     entry: join(__dirname, 'src', 'index.ts'),     output: {         path: join(__dirname, '..', '..', 'dist', 'server'),         filename: 'server.js'     },     target: 'node',     plugins: serverPlugins,     module: {         rules: [tsRuleServer]     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>apps\/web<\/em>app\/webpack.part.ts<\/p>\n<pre><code>import {Configuration, RuleSetRule, WatchIgnorePlugin, WebpackPluginInstance} from \"webpack\"; import HtmlWebpackPlugin from \"html-webpack-plugin\"; import {join} from \"path\"; import {tsRuleBase} from \"..\/..\/webpack.common\";  const webAppPlugins: WebpackPluginInstance[] = [     new HtmlWebpackPlugin(),     new WatchIgnorePlugin({         paths: [join(__dirname, '..', 'apps', 'server')]     }) ] const tsRuleWebApp: RuleSetRule = {     ...tsRuleBase,     options: {         configFile: join(__dirname, 'tsconfig.json')     } } export const webAppConfig: Configuration = {     entry: join(__dirname, 'src', 'index.ts'),     output: {         path: join(__dirname, '..', '..', 'dist', 'web_app'),         filename: 'bundle.js'     },     target: 'web',     plugins: webAppPlugins,     module: {         rules: [tsRuleWebApp]     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 &#8212; \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f <code>ts-loader<\/code>, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a <code>configFile: join(__dirname, 'tsconfig.json')<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a <code>__dirname<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0435\u043d. \u0422\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 backend \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e EcmaScript  esnext, \u0430 \u0434\u043b\u044f frontend \u0432 es6.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434 &#171;UNLICENSE&#187;. \u0427\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Github: <a href=\"https:\/\/github.com\/shaltaev\/webpack-with-config-on-typescript\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 TS &#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u0431\u0438\u0437\u043d\u0435\u0441 \u0444\u0438\u0447\u0430. \u041d\u043e \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u043a\u043e\u043c\u0444\u043e\u0440\u0442 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 micro-frontend c \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ModuleFederationPlugin<\/code>, \u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 webpack \u0440\u0430\u0441\u0442\u0435\u0442 \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u043c\u0438\u043a\u0440\u043e-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438 \u043a\u043e\u043c\u0444\u043e\u0440\u0442 \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0430\u0436\u0435\u043d, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0447\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u0442\u0440\u0430\u0447\u0435\u043d\u043d\u043e\u0435 \u043d\u0430 \u0438\u043c\u0435\u043d\u043d\u043e TS \u0442\u0443\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435.<\/p>\n<p>PS. \u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0432 docker (\u0434\u043b\u044f VSCode \u0438 JetBrains)<\/p>\n<\/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:\/\/habr.com\/ru\/post\/535734\/\"> https:\/\/habr.com\/ru\/post\/535734\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041b\u0435\u0433\u0435\u043d\u0434\u0430<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u0437\u0430\u0440\u043e\u0434\u0438\u043b\u0441\u044f, \u0442\u043e \u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043a\u0430\u0436\u0434\u043e\u043c\u0443. \u0411\u0435\u043b\u044b\u0439 \u043b\u0438\u0441\u0442\u0430 \u0431\u0443\u043c\u0430\u0433\u0438 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043d\u0430 \u043d\u0435\u0433\u043e \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0438 \u0432\u043e\u043e\u0431\u0440\u0430\u0436\u0430\u043b \u043a\u0430\u043a\u0438\u0435 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043e\u0442\u043a\u0440\u043e\u044e\u0442\u0441\u044f, \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0440\u0435\u0448\u0430\u0442\u0441\u044f. <\/p>\n<p>\u0412\u043e\u0442 \u043d\u0430 \u0431\u0443\u043c\u0430\u0433\u0443 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043d\u0430\u043d\u0435\u0441 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u043b\u043e\u043a. \u0421\u0437\u0430\u0434\u0438 \u0440\u0430\u0437\u0434\u0430\u043b\u0430\u0441\u044c \u0440\u0443\u0433\u0430\u043d\u044c. \u042d\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u0441\u043f\u043e\u0440\u0438\u043b\u0438: \u041a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0438 \u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u0440\u0442\u0435\u0440 \u0432\u044b\u0431\u0440\u0430\u0442\u044c. \u0423 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u043e \u0441\u043f\u0438\u043d\u0435 \u043f\u0440\u043e\u043d\u0435\u0441\u0441\u044f \u0445\u043e\u043b\u043e\u0434\u043e\u043a. \u041d\u0435 \u0443\u0441\u043f\u0435\u043b\u0430 \u0441\u043b\u043e\u0436\u0438\u043b\u0430\u0441\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f Proof Of Concept, \u043d\u0435 \u0442\u043e \u0447\u0442\u043e \u0434\u043b\u044f Minimal Valuable Product, \u043d\u043e \u0443\u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u043f\u0440\u0435\u043f\u044f\u0442\u0441\u0442\u0432\u0438\u044f. \u0412\u044b\u0431\u043e\u0440 \u0441\u0442\u0430\u0440\u0442\u0435\u0440\u0430 \u043d\u0430\u043b\u043e\u0436\u0438\u0442 \u043f\u043e\u043a\u0430 \u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0440\u0430\u043c\u043a\u0438.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0431\u044b\u043b\u043e \u044f\u0441\u043d\u043e, \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043f\u043e\u0434\u043e\u0448\u0435\u043b \u043a Team Lead \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c WebPack \u0438 \u0447\u0438\u0441\u0442\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0435\u0437 \u0441\u0442\u0430\u0440\u0442\u0435\u0440\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e \u043f\u0440\u043e\u0448\u043b\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c \u0441 \u043d\u0438\u043c \u0432 \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043c\u0435\u0440\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<h3>\u041c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h3>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0442\u043e \u0432 2020 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u0440\u0430\u0443\u0437\u0435\u0440 &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0441\u0431\u043e\u0440\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e WebPack.<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u043b\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043b\u0438 \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u043d\u0443\u0436\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 create-react-app.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447 \u043c\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435\u0442. \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0430\u043c\u0438 \u043e\u0442\u043b\u043e\u0436\u0430\u0442\u0441\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0435.<\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u044b\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0438 loader&#8217;s \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443, \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 95% \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442. \u0414\u0430\u0436\u0435 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f. \u041c\u0430\u043b\u043e \u043a\u0442\u043e \u0441\u0445\u043e\u0434\u0443 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442 <code>devtool<\/code> \u0438\u043b\u0438 <code>devtools<\/code>. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u043b\u0438\u0441\u044c \u043a \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 WebPack. \u0423\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043f\u043b\u0435\u0447\u0438 TypeScript.<\/p>\n<p>\u041f\u0430\u0440\u0443 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043c\u043d\u0435 \u043d\u0435 \u043d\u0430\u0445\u0432\u0430\u0442\u0430\u043b\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0441\u0430\u043c\u043e\u0433\u043e WebPack \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435: <a href=\"https:\/\/webpack.js.org\/configuration\/configuration-languages\/#typescript\" rel=\"noopener noreferrer nofollow\">\u0432\u043e\u0442 \u0441\u0441\u044b\u043b\u043a\u0430<\/a>.<\/p>\n<h3>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435<\/h3>\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u0442 \u0446\u0435\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435\u043e\u0431\u044a\u0435\u043c\u043b\u044e\u0449\u0438\u0439 \u043c\u0430\u043d\u0443\u0430\u043b \u043f\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435, \u0431\u0443\u0434\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f backend \u0438 frontend.<\/p>\n<p>C\u0435\u0440\u0432\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441 FE \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430. \u0421\u0430\u043c \u0436\u0435 FE \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <code>Hello World!<\/code>. \u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043b\u044f BE \u0431\u0443\u0434\u0435\u0442 <code>node<\/code>, \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 <code>webpack<\/code>.<\/p>\n<p>GitHub: <a href=\"https:\/\/github.com\/shaltaev\/webpack-with-config-on-typescript\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c<\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043d\u043e-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 server \u0438 web<em>app \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/em><\/p>\n<ul>\n<li>\n<p><em>~\/project<\/em>folder\/   # \u041a\u043e\u0440\u0435\u043d\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>yarn init<\/code><\/p>\n<ul>\n<li>\n<p>\/apps  # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/p>\n<ul>\n<li>\n<p>\/server  # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f backend &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>yarn init<\/code><\/p>\n<ul>\n<li>\n<p>\/src # \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u0447\u0430\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a BE)<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\/web<em>app  # \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f frontend &#8212; \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <\/em><code>yarn init<\/code><\/p>\n<ul>\n<li>\n<p><em>\/src # \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/em><\/p>\n<\/li>\n<li>\n<p><em>\u0444\u0430\u0439\u043b\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (\u0447\u0430\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a FE)<\/em><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><em>\/<\/em>utils  # \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u043e\u0431\u0449\u0438\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0449\u0438\u0435 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>~\/project_folder<\/code><\/p>\n<\/li>\n<\/ul>\n<pre><code>yarn add -D @types\/node @types\/webpack concurrently cross-env nodemon ts-loader ts-node typescript webpack webpack-cli<\/code><\/pre>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>\/apps\/server<\/code> \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043f\u043e\u043c\u0438\u043c\u043e \u0442\u0435\u0445 \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432 \u043e\u0431\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <code>\/apps\/web_app<\/code> \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <code>html-webpack-plugin<\/code> 5 \u0432\u0435\u0440\u0441\u0438\u0438 \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441 WebPack 5 \u0432\u0435\u0440\u0441\u0438\u0438. \u041d\u0430 \u041c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0442 \u043f\u043e\u043a\u0435\u0442 \u0435\u0449\u0435 \u0432 beta \u0434\u043e\u0441\u0442\u0443\u043f\u0435.<\/p>\n<\/li>\n<\/ul>\n<pre><code>cd apps\/web_app yarn add -D html-webpack-plugin@5<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TypeScript<\/h3>\n<p>\u0411\u0440\u0430\u0443\u0437\u0435\u0440, server, \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 runner &#8212; \u044d\u0442\u043e \u0442\u0440\u0438 \u0441\u0440\u0435\u0434\u044b \u0441 \u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438:<\/p>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, node&nbsp;\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0427\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435:&nbsp;<a href=\"https:\/\/node.green\" rel=\"noopener noreferrer nofollow\">https:\/\/node.green<\/a><\/p>\n<p>\u041a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 <code>apps\/server\/tsconfig.json<\/code> \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u0431\u043e\u0440\u043a\u0443, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 webpack \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b \u043f\u0443\u0442\u044c \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043d\u0430 \u043a\u043e\u043d\u0435\u0446 2020, \u043b\u0443\u0447\u0448\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c&nbsp;ES6&nbsp;\u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c Internet Explorer 11. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u0441\u0430\u0439\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439: <a href=\"https:\/\/caniuse.com\" rel=\"noopener noreferrer nofollow\">https:\/\/caniuse.com<\/a><\/p>\n<p> \u0424\u0430\u0439\u043b: <code>apps\/web_app\/tsconfig.json<\/code><\/p>\n<p>\u041a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 runner \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0442\u043e\u0436\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439 \u043b\u0435\u0433\u043a\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043c\u044b. \u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f TS, \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <code>ts-node<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c webpack. <\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p>tsconfig.json<\/p>\n<pre><code>\"compilerOptions\": {     \"module\": \"commonjs\",     \"target\": \"es5\",     \"esModuleInterop\": true   }<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u0438 \u0447\u0430\u0441\u0442\u044c\u044e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0430\u043c\u043e\u0433\u043e webpack \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 typescript<\/p>\n<\/div>\n<\/details>\n<h3>\u0421\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442, \u0440\u0430\u0437\u0434\u0430\u0447\u0435\u0439 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438. \u041a\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 (<a href=\"https:\/\/nodejs.org\/en\/knowledge\/HTTP\/servers\/how-to-serve-static-files\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0430<\/a>) \u0441 \u0441\u0430\u0439\u0442\u0430 node, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c \u043f\u0430\u043f\u043a\u0430\u043c <code>..\\..\\secret<\/code> \u0432 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430\u0445.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p>apps\/server\/src\/index.ts<\/p>\n<pre><code class=\"javascript\">import { resolve, normalize, join } from 'path' import { createServer, RequestListener} from 'http' import { readFile } from 'fs'   const webAppBasePath = '..\/web_app'; \/\/ \u042d\u0442\u043e \u043f\u0443\u0442\u044c \u0434\u043e \u043f\u0430\u043f\u043a\u0438 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 build (\u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 dist)  const handleWebApp: RequestListener = (req, res) =&gt; {     const resolvedBase = resolve(__dirname ,webAppBasePath);     const safeSuffix = normalize(req.url || '')         .replace(\/^(\\.\\.[\\\/\\\\])+\/, '');     const fileLocation = join(resolvedBase, safeSuffix);      readFile(fileLocation, function(err, data) {         if (err) {             res.writeHead(404, 'Not Found');             res.write('404: File Not Found!');             return res.end();         }          res.statusCode = 200;          res.write(data);         return res.end();     });  };  const httpServer = createServer(handleWebApp)  httpServer.listen(\"5000\", () =&gt; {     console.info('Listen on 5000 port') })<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>Frontend \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n<p>Web \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435. \u0412 <code>document.body<\/code> \u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <code>&amp;lt;div id=\"root\"&gt;Hello world!&amp;lt;\/div&gt;<\/code><\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p>apps\/web<em>app\/src\/index.ts<\/em><\/p>\n<pre><code>const rootNode = document.createElement('div') rootNode.setAttribute('id', 'root') rootNode.innerText = 'Hello World!'  document.body.appendChild(rootNode)<\/code><\/pre>\n<\/div>\n<\/details>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 WebPack<\/h3>\n<p><em>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c webpack.<\/em><\/p>\n<p><em>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u044b. \u0410 \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c TS, \u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <\/em><code>import {serverConfig} from \".\/apps\/server\/webpack.part\";<\/code> \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>webpack.config.ts<\/em><\/p>\n<pre><code>import {serverConfig} from \".\/apps\/server\/webpack.part\"; import {webAppConfig} from \".\/apps\/web_app\/webpack.part\"; import {commonConfig} from \".\/webpack.common\";  export default [     \/** server  **\/ {...commonConfig, ...serverConfig},     \/** web_app **\/ {...commonConfig, ...webAppConfig}, ]<\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u0412 \u043d\u0435\u043c \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u0441 \u043e\u0431\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u044c\u044e.<\/em><\/p>\n<p><em>\u041e\u0431\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c<\/em><\/p>\n<p><em>\u041e\u0431\u0449\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u043c\u0438. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u043e\u043b\u044f <\/em><code>mode<\/code> \u0438 <code>resolve<\/code>. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0443 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f <code>const commonConfig: Configuration<\/code>, \u0442\u0438\u043f \u0432\u0437\u044f\u0442 \u0438\u0437 <code>import {Configuration} from \"webpack\";<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>webpack.common.ts<\/em><\/p>\n<pre><code>import {Configuration, RuleSetRule} from \"webpack\"; import {isDev} from \".\/apps\/_utils\";  export const tsRuleBase: RuleSetRule = {     test: \/\\.ts$\/i,     loader: 'ts-loader', }  export const commonConfig: Configuration = {     mode: isDev ? 'development' : 'production',     resolve: {         extensions: ['.tsx', '.ts', '.js', '.json'],     }, } <\/code><\/pre>\n<\/div>\n<\/details>\n<p><em>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u043b\u0435\u0436\u0438\u0442 \u043e\u0431\u0449\u0430\u044f \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 TS \u0444\u0430\u0439\u043b\u043e\u0432 <\/em><code>const tsRuleBase: RuleSetRule<\/code>, \u0442\u0438\u043f \u0432\u0437\u044f\u0442 \u0438\u0437 <code>import {RuleSetRule} from \"webpack\";<\/code>.<\/p>\n<p><code>isDev<\/code> \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <code>isDev = process.env.NODE_ENV === 'development'<\/code> <\/p>\n<p><em>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f FE \u0438 BE<\/em><\/p>\n<p><em>\u0422\u0443\u0442 \u0443\u0436\u0435 \u0432\u0441\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 webpack, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430\u043c\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 <\/em><code>import {Configuration, RuleSetRule, WebpackPluginInstance} from \"webpack\";<\/code><\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <\/em><code>WatchIgnorePlugin<\/code> \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043d\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0444\u0430\u0439\u043b\u044b \u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 \u043d\u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>apps\/server\/webpack.part.ts<\/em><\/p>\n<pre><code>import {Configuration, RuleSetRule, WatchIgnorePlugin, WebpackPluginInstance} from \"webpack\"; import {join} from \"path\"; import {tsRuleBase} from \"..\/..\/webpack.common\";  const serverPlugins: WebpackPluginInstance[] = [     new WatchIgnorePlugin({         paths: [join(__dirname, '..', 'apps', 'web_app')]     }) ] const tsRuleServer: RuleSetRule = {     ...tsRuleBase,     options: {         configFile: join(__dirname, 'tsconfig.json')     } } export const serverConfig: Configuration = {     entry: join(__dirname, 'src', 'index.ts'),     output: {         path: join(__dirname, '..', '..', 'dist', 'server'),         filename: 'server.js'     },     target: 'node',     plugins: serverPlugins,     module: {         rules: [tsRuleServer]     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<p><em>apps\/web<\/em>app\/webpack.part.ts<\/p>\n<pre><code>import {Configuration, RuleSetRule, WatchIgnorePlugin, WebpackPluginInstance} from \"webpack\"; import HtmlWebpackPlugin from \"html-webpack-plugin\"; import {join} from \"path\"; import {tsRuleBase} from \"..\/..\/webpack.common\";  const webAppPlugins: WebpackPluginInstance[] = [     new HtmlWebpackPlugin(),     new WatchIgnorePlugin({         paths: [join(__dirname, '..', 'apps', 'server')]     }) ] const tsRuleWebApp: RuleSetRule = {     ...tsRuleBase,     options: {         configFile: join(__dirname, 'tsconfig.json')     } } export const webAppConfig: Configuration = {     entry: join(__dirname, 'src', 'index.ts'),     output: {         path: join(__dirname, '..', '..', 'dist', 'web_app'),         filename: 'bundle.js'     },     target: 'web',     plugins: webAppPlugins,     module: {         rules: [tsRuleWebApp]     } }<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041e\u0434\u0438\u043d \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432 &#8212; \u044d\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u043f\u0443\u0442\u0438 \u0434\u043e \u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f <code>ts-loader<\/code>, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a <code>configFile: join(__dirname, 'tsconfig.json')<\/code>. \u0422\u0430\u043a \u043a\u0430\u043a <code>__dirname<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0435\u043d. \u0422\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 backend \u0432\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0446\u0435\u043b\u0435\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e EcmaScript  esnext, \u0430 \u0434\u043b\u044f frontend \u0432 es6.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0434 &#171;UNLICENSE&#187;. \u0427\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Github: <a href=\"https:\/\/github.com\/shaltaev\/webpack-with-config-on-typescript\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 TS &#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0435 \u0431\u0438\u0437\u043d\u0435\u0441 \u0444\u0438\u0447\u0430. \u041d\u043e \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u043a\u043e\u043c\u0444\u043e\u0440\u0442 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0437\u0430\u043c\u0435\u0442\u043d\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 micro-frontend c \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ModuleFederation<\/code><\/p>\n<\/div>\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-315833","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315833","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=315833"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315833\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}