{"id":1549,"date":"2017-04-13T11:53:08","date_gmt":"2017-04-13T02:53:08","guid":{"rendered":"http:\/\/lovelinux.mydns.jp\/?p=1549"},"modified":"2017-04-28T14:55:58","modified_gmt":"2017-04-28T05:55:58","slug":"redux-todo%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab%e3%82%92-npm%e3%81%a8webpack%e3%81%a7%e6%9c%80%e5%b0%8f%e3%81%ae%e7%92%b0%e5%a2%83%e3%82%92%e4%bd%9c%e3%81%a3%e3%81%a6%e5%8b%95%e3%81%8b%e3%81%99-2","status":"publish","type":"post","link":"https:\/\/lovelinux.mydns.jp\/?p=1549","title":{"rendered":"Redux Todo\u30b5\u30f3\u30d7\u30eb\u3092 npm\u3068webpack\u3067\u6700\u5c0f\u306e\u74b0\u5883\u3092\u4f5c\u3063\u3066\u52d5\u304b\u3059"},"content":{"rendered":"<h3>\u306f\u3058\u3081\u306b<\/h3>\n<p>React\u306e\u52c9\u5f37\u3092\u306f\u3058\u3081\u3066\u3001\u5927\u96d1\u628a\u306b\u7406\u89e3\u3057\u305f\u3089\u3001Redux\u306e\u52c9\u5f37\u3092\u3057\u305f\u304f\u306a\u308a\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u3057\u304b\u3057\u307e\u3041\u30fb\u30fb\u30fbRedux\u30e0\u30ba\u30a4\uff01\uff01<\/p>\n<p>\u3068\u306a\u308b\u308f\u3051\u3067\u3001\u3068\u306b\u304b\u304fRedux\u672c\u5bb6\u306b\u3042\u308bTodo\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u30bd\u30fc\u30b9\u3092\u773a\u3081\u308b\u3082\u30fb\u30fb<br \/>\n\u308f\u304b\u3063\u305f\u3088\u3046\u306a\u308f\u304b\u3089\u306a\u3044\u3088\u3046\u306a\u72b6\u614b\u306b\u306a\u308b\u3002<br \/>\n\u514e\u306b\u3082\u89d2\u306b\u3082\u3001\u5b9f\u969b\u306b\u52d5\u304b\u3057\u3066\u307f\u306a\u304d\u3083\u59cb\u307e\u3089\u306a\u3044\u3002\u305d\u306e\u305f\u3081\u306e\u74b0\u5883\u3092\u4f5c\u308b\u306e\u3082<br \/>\n\u6700\u521d\u306f\u3061\u3093\u3077\u3093\u304b\u3093\u3077\u3093\u3060\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3059\u3088\u306d\u30fb\u30fb\u30fb<\/p>\n<p>\u306a\u306e\u3067\u3001Redux\u672c\u5bb6\u306b\u3042\u308bTodo\u30b5\u30f3\u30d7\u30eb\u3092npm \u3068 Webpack\u3092\u4f7f\u3063\u3066\u6700\u5c0f\u74b0\u5883\u3092\u4f5c\u3063\u3066<br \/>\n\u52d5\u4f5c\u3055\u305b\u308b\u3068\u3053\u308d\u307e\u3067\u305f\u3069\u308a\u7740\u304f\u306e\u304c\u4eca\u56de\u306e\u76ee\u6a19\u3067\u3059\u3002<br \/>\nTodo\u30b5\u30f3\u30d7\u30eb\u306e\u5185\u5bb9\u306b\u306f\u8e0f\u307f\u8fbc\u307f\u307e\u305b\u3093\u3001\u3042\u304f\u307e\u3067\u52d5\u304f\u3068\u3053\u308d\u307e\u3067\u3002<\/p>\n<p>\u6700\u7d42\u52d5\u4f5c\u30a4\u30e1\u30fc\u30b8\u306f\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<p><a href=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/redux-2-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/redux-2-1.png\" alt=\"redux-2\" width=\"504\" height=\"269\" class=\"alignnone size-full wp-image-1604\" \/><\/a><\/p>\n<p>\u4f5c\u308a\u4e0a\u3052\u308b\u30d5\u30a9\u30eb\u30c0\u3068\u30d5\u30a1\u30a4\u30eb\u306e\u69cb\u6210\u306f\u3053\u3093\u306a\u611f\u3058\u3002<br \/>\n<a href=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/redux-1-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/redux-1-1.png\" alt=\"redux-1\" width=\"210\" height=\"602\" class=\"alignnone size-full wp-image-1602\" \/><\/a><\/p>\n<h3>npm\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h3>\n<p>[bash]<br \/>\n$ cd ~\/workspace<br \/>\n$ mkdir redux_todo<br \/>\n$ cd redux_todo<br \/>\n$ npm init -y<br \/>\n$ npm install &#8211;save react react-dom redux react-redux<br \/>\n$ npm install &#8211;save-dev babel-core babel-loader babel-preset-es2015 babel-preset-react webpack webpack-dev-server<br \/>\n[\/bash]<\/p>\n<h3>packege.json\u3092\u8abf\u6574<\/h3>\n<p>\u5909\u66f4\u524d<br \/>\n[bash]<br \/>\n  &#8220;scripts&#8221;: {<br \/>\n    &#8220;test&#8221;: &#8220;echo \\&#8221;Error: no test specified\\&#8221; &#038;&#038; exit 1&#8243;<br \/>\n  },<\/p>\n<p>[\/bash]<\/p>\n<p>\u5909\u66f4\u5f8c\uff082\u884c\u8ffd\u8a18\uff09<br \/>\n[bash]<br \/>\n  &#8220;scripts&#8221;: {<br \/>\n    &#8220;test&#8221;: &#8220;echo \\&#8221;Error: no test specified\\&#8221; &#038;&#038; exit 1&#8243;,<br \/>\n    &#8220;start&#8221;: &#8220;webpack-dev-server &#8211;content-base dist\/ &#8211;hot &#8211;inline &#8211;progress &#8211;colors&#8221;,<br \/>\n    &#8220;build&#8221;: &#8220;webpack &#8211;progress &#8211;colors&#8221;<br \/>\n  },<\/p>\n<p>[\/bash]<\/p>\n<h3>webpack.config.js\u3092\u4f5c\u6210<\/h3>\n<p>[bash]<br \/>\n$ nano webpack.config.js<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\nvar path = require(&#8216;path&#8217;);<br \/>\nvar webpack = require(&#8216;webpack&#8217;);<\/p>\n<p>module.exports = {<br \/>\n  entry: {<br \/>\n    main: &#8216;.\/index.js&#8217;,<br \/>\n  },<br \/>\n  output: {<br \/>\n    path: path.join(__dirname, &#8216;dist&#8217;),<br \/>\n    filename: &#8220;[name].bundle.js&#8221;<br \/>\n  },<br \/>\n  module: {<br \/>\n    loaders: [<br \/>\n      {<br \/>\n        test: \/\\.js[x]?$\/,<br \/>\n        loader: &#8216;babel-loader&#8217;,<br \/>\n        exclude: \/node_modules\/,<br \/>\n        query: {<br \/>\n          presets: [&#8216;es2015&#8217;, &#8216;react&#8217;]<br \/>\n        }<br \/>\n      }<br \/>\n    ]<br \/>\n  },<br \/>\n  resolve: {<br \/>\n    extensions: [&#8216;.js&#8217;, &#8216;.jsx&#8217;]<br \/>\n  },<br \/>\n  devServer: {<br \/>\n    inline: true,<br \/>\n    hot: true<br \/>\n  }<br \/>\n}<\/p>\n<p>[\/bash]<\/p>\n<h3>dist\u30d5\u30a9\u30eb\u30c0\u6e96\u5099<\/h3>\n<p>[bash]<br \/>\n$ mkdir dist<br \/>\n[\/bash]<\/p>\n<h3>Todo\u30a2\u30d7\u30ea\u306e\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210(index.js)<\/h3>\n<p>\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb(Entry Point)\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308bindex.js\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n$ nano index.js<br \/>\n[\/bash]<\/p>\n<p>[bash]<br \/>\nimport React from &#8220;react&#8221;<br \/>\nimport {render} from &#8220;react-dom&#8221;<br \/>\nimport {createStore} from &#8220;redux&#8221;<br \/>\nimport {Provider} from &#8220;react-redux&#8221;<br \/>\nimport todoApp from &#8220;.\/reducers&#8221;<br \/>\nimport App from &#8220;.\/components\/App&#8221;<\/p>\n<p>document.write(&#8220;<\/p>\n<div id='root'><\/div>\n<p>&#8220;);<\/p>\n<p>let store = createStore(todoApp)<\/p>\n<p>render (<br \/>\n  <Provider store={store}><br \/>\n    <App \/><br \/>\n  <\/Provider>,<br \/>\n  document.getElementById(&#8220;root&#8221;)<br \/>\n)<\/p>\n<p>[\/bash]<\/p>\n<h3>\u3072\u305f\u3059\u3089 redux\u672c\u5bb6\u306eTodo\u306b\u8a18\u8f09\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u3066\u4f5c\u308b<\/h3>\n<p><a href=\"http:\/\/redux.js.org\/docs\/basics\/ExampleTodoList.html\">redux\u672c\u5bb6\u306e\u3053\u306e\u30da\u30fc\u30b8<\/a>\u3092\u898b\u306a\u304c\u3089<br \/>\n\u6700\u7d42\u76ee\u6a19\u3067\u3042\u308b\u3053\u306e\u30a4\u30e1\u30fc\u30b8\u306b\u5408\u3046\u3088\u3046\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u4e2d\u8eab\u3092\u30b3\u30d4\u30fc\u3057\u3066\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/redux-1-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/redux-1-1.png\" alt=\"redux-1\" width=\"210\" height=\"602\" class=\"alignnone size-full wp-image-1602\" \/><\/a><\/p>\n<h3>\u5168\u30d5\u30a1\u30a4\u30eb\u3092\u30de\u30fc\u30b8\u3057\u3066\u30b3\u30f3\u30d1\u30a4\u30eb<\/h3>\n<p>\u3053\u308c\u3057\u306a\u304f\u3066\u3082\u5927\u4e08\u592b\u3067\u3059\u3002\u30b3\u30f3\u30d1\u30a4\u30eb\u7d50\u679c\u3092\u77e5\u308a\u305f\u3044\u3068\u304d\u306f\u3001\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n[bash]<br \/>\n$ .\/node_modules\/.bin\/webpack<br \/>\n[\/bash]<\/p>\n<h3>\u8d77\u52d5\u78ba\u8a8d<\/h3>\n<p>[bash]<br \/>\n$ npm start<br \/>\n[\/bash]<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u30fc\u3067<\/p>\n<p><a href=\"http:\/\/localhost:8080\/webpack-dev-server\/main.bundle\">http:\/\/localhost:8080\/webpack-dev-server\/main.bundle<\/a><\/p>\n<p>\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u4e0b\u306e\u3088\u3046\u306a\u753b\u9762\u304c\u51fa\u3066\u304d\u305f\u3089OK\u3002<\/p>\n<p>\u203b\u8ffd\u8a18<br \/>\n\u4e0a\u8a18URL\u3067\u306f\u3046\u307e\u304f\u8868\u793a\u3067\u304d\u306a\u304f\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002package.json\u3067\u6307\u5b9a\u3057\u305fcontent-base\u304c<br \/>\n\u52b9\u304b\u306a\u3044\u30b1\u30fc\u30b9\u304c\u3042\u308b\u307f\u305f\u3044\uff08\u539f\u56e0\u4e0d\u660e\uff09<br \/>\n\u305d\u306e\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3002<br \/>\n<a href=\"http:\/\/localhost:8080\/webpack-dev-server\/dist\/main.bundle\">http:\/\/localhost:8080\/webpack-dev-server\/dist\/main.bundle<\/a><\/p>\n<p><a href=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/wp-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/lovelinux.mydns.jp\/wp-content\/uploads\/2017\/04\/wp-1.png\" alt=\"wp-1\" width=\"509\" height=\"227\" class=\"alignnone size-full wp-image-1597\" \/><\/a><\/p>\n<h3>redux\u5b66\u7fd2\u65b9\u6cd5<\/h3>\n<p>\u3068\u306b\u304b\u304f\u76ee\u3092\u76bf\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u3072\u305f\u3059\u3089\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3092\u8ffd\u3044\u304b\u3051\u308b\u3002<\/p>\n<p>\u8ffd\u3044\u304b\u3051\u308b<\/p>\n<p>\u8ffd\u3044\u304b\u3051\u308b<\/p>\n<p>\u8ffd\u3044\u304b\u3051\u308b\uff08\u7b11\uff09<\/p>\n<p><a href=\"https:\/\/intheweb.io\/react-redux-todos\/\">\u3053\u306e\u30da\u30fc\u30b8\u306e\u89e3\u8aac(react\u3068redux\u3092\u4f7f\u3063\u305fExample\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u30ea\u30fc\u30c7\u30a3\u30f3\u30b0:todos\u7de8)<\/a> \u306a\u304b\u306a\u304b\u826f\u304f\u51fa\u6765\u3066\u3044\u308b\u306e\u3067\u53c2\u7167\u3057\u305f\u3089\u3044\u3044\u3067\u3059\u3002<\/p>\n<h3>\u88dc\u8db3<\/h3>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u3044\u3058\u3063\u305f\u3089\u3001\u81ea\u52d5\u3067\u66f4\u65b0\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u4fbf\u5229\u3002\u3002\u3002<br \/>\nwebpack.config.js\u3000\u3067\u6307\u5b9a\u3057\u305f dist \u30d1\u30b9\u3078\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u6765\u307e\u305b\u3093\u304c<br \/>\n\u30e1\u30e2\u30ea\u4e0a\u3067\u5c55\u958b\u3055\u308c\u3066\u52d5\u304f\u3089\u3057\u3044\u3067\u3059\u3002<br \/>\n\u3069\u3093\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001dist\/main.bundle.js\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n$ .\/node_modules\/.bin\/webpack<br \/>\n[\/bash]<\/p>\n<h3>\u5b9f\u904b\u7528\u3092\u60f3\u5b9a\u3057\u3066index.html\u3092\u4f5c\u6210<\/h3>\n<p>\u5b9f\u904b\u7528\u3067\u306f\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u3068\u306a\u308bHTML\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001dist\u30d5\u30a9\u30eb\u30c0\u306bindex.html\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>[bash]<br \/>\n<!DOCTYPE html><br \/>\n<html><br \/>\n  <head><br \/>\n    <meta charset=\"utf-8\"><br \/>\n    <title>Redux Todo<\/title><br \/>\n    <script type=\"text\/javascript\" src=\".\/main.bundle.js\"><\/script><br \/>\n  <\/head><br \/>\n  <body><\/p>\n<p>  <\/body><br \/>\n<\/html><\/p>\n<p>[\/bash]<\/p>\n<p>\u3053\u308c\u3067\u3001<br \/>\n<a href=\"http:\/\/localhost:8080\">http:\/\/localhost:8080<\/a><br \/>\n\u3067\u5b9f\u904b\u7528\u306e\u52d5\u4f5c\u30a4\u30e1\u30fc\u30b8\u306e\u51fa\u6765\u4e0a\u304c\u308a\u3002<\/p>\n<h3>\u611f\u60f3\u3068\u3046\u304b\u96d1\u611f\u3068\u3044\u3046\u304b<\/h3>\n<p>Redux\u3000\u304b\u306a\u308a\u96e3\u3057\u3044\u3067\u3059\u3088\u306d\u3002<br \/>\nReact\u306f\u307b\u307c\u5206\u304b\u3063\u305f\u306e\u3067\u3001Redux\u3082\u697d\u52dd\u3060\u308d\u3046\u3068\u601d\u3044\u304d\u3084\u30fb\u30fb\u30fb\u30fb<br \/>\nRedux\u672c\u5bb6\u306e\u3053\u306eTodo\u30b5\u30f3\u30d7\u30eb\u3092\u7406\u89e3\u3057\u3066\u3001\u5199\u7d4c\u3057\u3066\u3001\u7a7a\u3067\u6697\u8a18\u3057\u3066\u30a4\u30c1\u304b\u3089\u4f5c\u308a\u4e0a\u3052\u308c\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067<br \/>\n3\u65e5\u307b\u3069\u8981\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Redux\u304a\u305d\u308b\u3079\u3057\u3002<\/p>\n<p>\u3063\u3066\u304b\u3001\u3053\u3093\u306a\u306e\u7406\u89e3\u3057\u3066\u3001\u307f\u3093\u306a\u958b\u767a\u3057\u3066\u308b\u306e\u304b\u306a\u30fb\u30fb\u30fb<br \/>\nRedux\u3068React\u306e\u7d44\u307f\u5408\u308f\u305b\u3001\u304b\u306a\u308a\u96e3\u3057\u3044\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u306a\u3041\u30fb\u30fb\u30fb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b React\u306e\u52c9\u5f37\u3092\u306f\u3058\u3081\u3066\u3001\u5927\u96d1\u628a\u306b\u7406\u89e3\u3057\u305f\u3089\u3001Redux\u306e\u52c9\u5f37\u3092\u3057\u305f\u304f\u306a\u308a\u307e\u3059\u3088\u306d\u3002 \u3057\u304b\u3057\u307e\u3041\u30fb\u30fb\u30fbRedux\u30e0\u30ba\u30a4\uff01\uff01 \u3068\u306a\u308b\u308f\u3051\u3067\u3001\u3068\u306b\u304b\u304fRedux\u672c\u5bb6\u306b\u3042\u308bTodo\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u30bd\u30fc\u30b9\u3092\u773a\u3081\u308b\u3082\u30fb\u30fb \u308f\u304b\u3063\u305f\u3088\u3046\u306a\u308f\u304b\u3089\u306a\u3044\u3088\u3046\u306a\u72b6\u614b\u306b\u306a\u308b\u3002 \u514e\u306b\u3082\u89d2\u306b\u3082\u3001\u5b9f\u969b\u306b\u52d5\u304b\u3057\u3066\u307f\u306a\u304d\u3083\u59cb\u307e\u3089\u306a\u3044\u3002\u305d\u306e\u305f\u3081\u306e\u74b0\u5883\u3092\u4f5c\u308b\u306e\u3082 \u6700\u521d\u306f\u3061\u3093\u3077\u3093\u304b\u3093\u3077\u3093\u3060\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u3059\u3088\u306d\u30fb\u30fb\u30fb \u306a\u306e\u3067\u3001Redux\u672c\u5bb6\u306b\u3042\u308bTodo\u30b5\u30f3\u30d7\u30eb\u3092npm \u3068 Webpack\u3092\u4f7f\u3063\u3066\u6700\u5c0f\u74b0\u5883\u3092\u4f5c\u3063\u3066 \u52d5\u4f5c\u3055\u305b\u308b\u3068\u3053\u308d\u307e\u3067\u305f\u3069\u308a\u7740\u304f\u306e\u304c\u4eca\u56de\u306e\u76ee\u6a19\u3067\u3059\u3002 Todo\u30b5\u30f3\u30d7\u30eb\u306e\u5185\u5bb9\u306b\u306f\u8e0f\u307f\u8fbc\u307f\u307e\u305b\u3093\u3001\u3042\u304f\u307e\u3067\u52d5\u304f\u3068\u3053\u308d\u307e\u3067\u3002 \u6700\u7d42\u52d5\u4f5c\u30a4\u30e1\u30fc\u30b8\u306f\u3053\u3093\u306a\u611f\u3058\u3002 \u4f5c\u308a\u4e0a\u3052\u308b\u30d5\u30a9\u30eb\u30c0\u3068\u30d5\u30a1\u30a4\u30eb\u306e\u69cb\u6210\u306f\u3053\u3093\u306a\u611f\u3058\u3002 npm\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b [bash] $ cd ~\/workspace $ mkdir redux_todo $ cd redux_todo $ npm init -y $ npm install &#8211;save react react-dom redux react-redux $ npm install &#8211;save-dev babel-core babel-loader babel-preset-es2015 babel-preset-react webpack webpack-dev-server [\/bash] packege.json\u3092\u8abf\u6574 \u5909\u66f4\u524d [bash] &#8220;scripts&#8221;: { &#8220;test&#8221;: &#8220;echo \\&#8221;Error: no test specified\\&#8221; &#038;&#038; exit 1&#8243; }, [\/bash] \u5909\u66f4\u5f8c\uff082\u884c\u8ffd\u8a18\uff09 [bash] &#8220;scripts&#8221;: { &#8220;test&#8221;: &#8220;echo \\&#8221;Error: no test specified\\&#8221; &#038;&#038; exit 1&#8243;, &#8220;start&#8221;: &#8220;webpack-dev-server &#8211;content-base dist\/ &#8211;hot &#8211;inline &#8211;progress &#8211;colors&#8221;, &#8220;build&#8221;: &#8220;webpack &#8211;progress &#8211;colors&#8221; }, [\/bash] webpack.config.js\u3092\u4f5c\u6210 [bash] $ nano webpack.config.js [\/bash] [bash] var path = require(&#8216;path&#8217;); var webpack = require(&#8216;webpack&#8217;); module.exports = { entry: { main: &#8216;.\/index.js&#8217;, }, output: { path: path.join(__dirname, &#8216;dist&#8217;), filename: &#8220;[name].bundle.js&#8221; }, module: { loaders: [ { test: \/\\.js[x]?$\/, loader: &#8216;babel-loader&#8217;, exclude: \/node_modules\/, query: { presets: [&#8216;es2015&#8217;, &#8216;react&#8217;] } } ] }, resolve: { extensions: [&#8216;.js&#8217;, &#8216;.jsx&#8217;] }, devServer: { inline: true, hot: true } } [\/bash] dist\u30d5\u30a9\u30eb\u30c0\u6e96\u5099 [bash] $ mkdir dist [\/bash] Todo\u30a2\u30d7\u30ea\u306e\u30c8\u30c3\u30d7\u30ec\u30d9\u30eb\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210(index.js) \u30c8\u30c3\u30d7\u30ec\u30d9\u30eb(Entry Point)\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308bindex.js\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 [bash] $ nano index.js [\/bash] [bash] import React from &#8220;react&#8221; import {render} from &#8220;react-dom&#8221; import {createStore} from &#8220;redux&#8221; import {Provider} from &#8220;react-redux&#8221; import todoApp from &#8220;.\/reducers&#8221; import App from &#8220;.\/components\/App&#8221; document.write(&#8220; &#8220;); let store = createStore(todoApp) render ( , document.getElementById(&#8220;root&#8221;) ) [\/bash] \u3072\u305f\u3059\u3089 redux\u672c\u5bb6\u306eTodo\u306b\u8a18\u8f09\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u3066\u4f5c\u308b redux\u672c\u5bb6\u306e\u3053\u306e\u30da\u30fc\u30b8\u3092\u898b\u306a\u304c\u3089 \u6700\u7d42\u76ee\u6a19\u3067\u3042\u308b\u3053\u306e\u30a4\u30e1\u30fc\u30b8\u306b\u5408\u3046\u3088\u3046\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3063\u3066\u4e2d\u8eab\u3092\u30b3\u30d4\u30fc\u3057\u3066\u304d\u307e\u3059\u3002 \u5168\u30d5\u30a1\u30a4\u30eb\u3092\u30de\u30fc\u30b8\u3057\u3066\u30b3\u30f3\u30d1\u30a4\u30eb \u3053\u308c\u3057\u306a\u304f\u3066\u3082\u5927\u4e08\u592b\u3067\u3059\u3002\u30b3\u30f3\u30d1\u30a4\u30eb\u7d50\u679c\u3092\u77e5\u308a\u305f\u3044\u3068\u304d\u306f\u3001\u3084\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002 [bash] $ .\/node_modules\/.bin\/webpack [\/bash] \u8d77\u52d5\u78ba\u8a8d [bash] $ npm start [\/bash] \u30d6\u30e9\u30a6\u30b6\u30fc\u3067 http:\/\/localhost:8080\/webpack-dev-server\/main.bundle \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u3001\u4e0b\u306e\u3088\u3046\u306a\u753b\u9762\u304c\u51fa\u3066\u304d\u305f\u3089OK\u3002 \u203b\u8ffd\u8a18 \u4e0a\u8a18URL\u3067\u306f\u3046\u307e\u304f\u8868\u793a\u3067\u304d\u306a\u304f\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002package.json\u3067\u6307\u5b9a\u3057\u305fcontent-base\u304c \u52b9\u304b\u306a\u3044\u30b1\u30fc\u30b9\u304c\u3042\u308b\u307f\u305f\u3044\uff08\u539f\u56e0\u4e0d\u660e\uff09 \u305d\u306e\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306eURL\u306b\u30a2\u30af\u30bb\u30b9\u3002 http:\/\/localhost:8080\/webpack-dev-server\/dist\/main.bundle redux\u5b66\u7fd2\u65b9\u6cd5 \u3068\u306b\u304b\u304f\u76ee\u3092\u76bf\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u3072\u305f\u3059\u3089\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u3092\u8ffd\u3044\u304b\u3051\u308b\u3002 \u8ffd\u3044\u304b\u3051\u308b \u8ffd\u3044\u304b\u3051\u308b \u8ffd\u3044\u304b\u3051\u308b\uff08\u7b11\uff09 \u3053\u306e\u30da\u30fc\u30b8\u306e\u89e3\u8aac(react\u3068redux\u3092\u4f7f\u3063\u305fExample\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u30ea\u30fc\u30c7\u30a3\u30f3\u30b0:todos\u7de8) \u306a\u304b\u306a\u304b\u826f\u304f\u51fa\u6765\u3066\u3044\u308b\u306e\u3067\u53c2\u7167\u3057\u305f\u3089\u3044\u3044\u3067\u3059\u3002 \u88dc\u8db3 \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u3044\u3058\u3063\u305f\u3089\u3001\u81ea\u52d5\u3067\u66f4\u65b0\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u4fbf\u5229\u3002\u3002\u3002 webpack.config.js\u3000\u3067\u6307\u5b9a\u3057\u305f dist \u30d1\u30b9\u3078\u30b3\u30f3\u30d1\u30a4\u30eb\u5f8c\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u51fa\u6765\u307e\u305b\u3093\u304c \u30e1\u30e2\u30ea\u4e0a\u3067\u5c55\u958b\u3055\u308c\u3066\u52d5\u304f\u3089\u3057\u3044\u3067\u3059\u3002 \u3069\u3093\u306a\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u3089\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u3001dist\/main.bundle.js\u304c\u51fa\u6765\u307e\u3059\u3002 [bash] $ .\/node_modules\/.bin\/webpack [\/bash] \u5b9f\u904b\u7528\u3092\u60f3\u5b9a\u3057\u3066index.html\u3092\u4f5c\u6210 \u5b9f\u904b\u7528\u3067\u306f\u30a8\u30f3\u30c8\u30ea\u30fc\u30dd\u30a4\u30f3\u30c8\u3068\u306a\u308bHTML\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001dist\u30d5\u30a9\u30eb\u30c0\u306bindex.html\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 [bash] Redux Todo [\/bash] \u3053\u308c\u3067\u3001 http:\/\/localhost:8080 \u3067\u5b9f\u904b\u7528\u306e\u52d5\u4f5c\u30a4\u30e1\u30fc\u30b8\u306e\u51fa\u6765\u4e0a\u304c\u308a\u3002 \u611f\u60f3\u3068\u3046\u304b\u96d1\u611f\u3068\u3044\u3046\u304b Redux\u3000\u304b\u306a\u308a\u96e3\u3057\u3044\u3067\u3059\u3088\u306d\u3002 React\u306f\u307b\u307c\u5206\u304b\u3063\u305f\u306e\u3067\u3001Redux\u3082\u697d\u52dd\u3060\u308d\u3046\u3068\u601d\u3044\u304d\u3084\u30fb\u30fb\u30fb\u30fb Redux\u672c\u5bb6\u306e\u3053\u306eTodo\u30b5\u30f3\u30d7\u30eb\u3092\u7406\u89e3\u3057\u3066\u3001\u5199\u7d4c\u3057\u3066\u3001\u7a7a\u3067\u6697\u8a18\u3057\u3066\u30a4\u30c1\u304b\u3089\u4f5c\u308a\u4e0a\u3052\u308c\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067 3\u65e5\u307b\u3069\u8981\u3057\u307e\u3057\u305f\u3002 Redux\u304a\u305d\u308b\u3079\u3057\u3002 \u3063\u3066\u304b\u3001\u3053\u3093\u306a\u306e\u7406\u89e3\u3057\u3066\u3001\u307f\u3093\u306a\u958b\u767a\u3057\u3066\u308b\u306e\u304b\u306a\u30fb\u30fb\u30fb Redux\u3068React\u306e\u7d44\u307f\u5408\u308f\u305b\u3001\u304b\u306a\u308a\u96e3\u3057\u3044\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u306a\u3041\u30fb\u30fb\u30fb<\/p>\n","protected":false},"author":1,"featured_media":1413,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[77],"tags":[72,76],"class_list":{"0":"post-1549","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-react","8":"tag-reactjs","9":"tag-redux"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1549"}],"version-history":[{"count":11,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1549\/revisions"}],"predecessor-version":[{"id":1645,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/posts\/1549\/revisions\/1645"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=\/wp\/v2\/media\/1413"}],"wp:attachment":[{"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lovelinux.mydns.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}