ããããã®åæåé¡ã¨ãã¦React-Nativeã§ã¯HMRãæå¹åãã¦ãStateless Functional Component(以ä¸SFC)ã«å¯¾ãã¦hot module replacement(以ä¸HMR)ãã¦ãããªãåé¡ãããã https://github.com/facebook/react-native/issues/10991 ä¸è¨ã®issueã«è¨è¼ããã babel-plugin-functional-hmr ãå ¥ãããã¨ã§SFCã«å¯¾ãã¦ãHMRãæå¹ååºæ¥ããããã§å ¨ã¦è§£æ±ºï¼ã¨è¡ãã°è¯ãã®ã ãããã babel-plugin-functional-hmrãæå¹åããç¶æ ã§jestã®snapshotãã¹ããããã¨ãã¹ãã±ã¼ã¹ã失æãããã¨ããã ã©ãããã±ã¼ã¹ã§å¤±æããã®ãï¼ æ®æ®µåã¯æ¥åã§ããã©ã¤ãã¼ãã§ã styled-components ã使ç¨ãã¦ãã¾ãã ä»åã®
注æï¼ãã®è¨äºã§ã¯ Babel 5 ã使ã£ã¦ãã¾ãã Babel 6 ã使ç¨ããå ´åã¯ããã®ã¾ã¾ã ã¨åä½ãã¾ããã対å¿æ¹æ³ã¯ãQuick guide: how to update Babel 5.x -> 6.x â Medium çãåç §ãã¦ä¸ããã Grunt ã Gulp ãªã©ã®ã¿ã¹ã¯ã©ã³ãã¼ã使ãããwebpack ã ãã§ããã³ãã¨ã³ããéçºããæ¹æ³ã調ã¹ã¦ã¿ã¾ããã 以ä¸ãå®éã«ç°¡åãªã¦ã§ãã¢ããªã±ã¼ã·ã§ã³ãä½ã£ã¦ã¿ã¾ãã ç°å¢ webpack 1.12.0 ESLint v1.2.1 OS X 10.10.5 åææ¡ä»¶ JavaScript㯠ECMAScript 6 ã§æ¸ããããã«ãã¾ããä½ããä»åã®è¨äºå ã§ã¯ ECMAScript 5ã®ææ³ã®ã¿ä½¿ç¨ãã¦ãã¾ãã CSSãã¡ã¤ã«ã¯ webpackã§å¦çãããã¨ã«ãããJavaScript ã®ã³ã¼ãã§è¡¨ç¾ãããããã«ãªãã¾ããã
æ¦è¦ JavaScriptã®éçºæã«ãXcodeãªã©ã®IDE並ã®ç°å¢ãç¨æãã¹ããé²åã«è¿½ãã¤ãã¦ããªãã£ãããã³ãã¨ã³ãã®éçºãã¼ã«å¨ãã試ãã¦æ§ç¯ããã æè¿ã¯ES2015ã§ã³ã¼ããæ¸ãã®ã§babelã§ES5ã«å¤æããã®ãå¿ é ããããªãã¨éçºæã®ã½ã¼ã¹ã¨å®è¡æã®ã¹ã¯ãªãããç°ãªãã®ã§ãã®ã¾ã¾ã§ã¯ãããã°ãã§ããªãï¼Chromeã®Developer Toolã§æ¢ãã¦ã¿ã¦ãæ¸ããã³ã¼ãã¨ã¯éã表ç¾ã®ã³ã¼ãä¸ã§æ¢ã¾ãï¼ã ãã®åé¡ã解決ãããããã«webpackã§ã¯éçºæã®ã½ã¼ã¹ã§ãããã°ãå¯è½ã«ããããã«Source Mappingã¨ããææ³ãå°å ¥ãã¦ãããããã¦ãããå©ç¨ãããã¨ã§Visual Studio CodeããChromeã¸ã®Remote Debuggingãå¯è½ã«ãªãã æ³å®ç°å¢ macOS Sierra Visual Studio Code ver.1.11.2 1.17.
HMRï¼Hot Module Replacementï¼ã¯Webpackãæä¾ããããã©ã¦ã¶ã®ãªãã¼ãããããã¨ç¡ãã¢ããªã±ã¼ã·ã§ã³ã®JSãæ´æ°ããéçºãã¼ã«ã§ãã Reactã§ã¯BabelãWebpackã®ãã©ã°ã¤ã³ã§ã¢ããªã±ã¼ã·ã§ã³ã³ã¼ãã«æ³¨å ¥ãããã¨ã§å®ç¾ãã¦ãã¾ãããReact以å¤ã§ãHMRãè¡ããã¨ãã§ãã¾ãããã ããHMRã«å¯¾å¿ãããããã«ã¯ããã¤ãã¢ã¸ã¥ã¼ã«ãã¢ããªã±ã¼ã·ã§ã³ã«åãããå®è£ ãå¿ è¦ã§ãã Reactãã©ããã£ã¦HMRã«å¯¾å¿ãã¦ããããç解ãããããReactã§ãªãã¢ããªã±ã¼ã·ã§ã³ã§å¿ è¦ãªå®è£ ã«ã¤ãã¦ãããã¦Reactã®å ´åä½ããã£ã¦ããããã¾ã¨ãã¾ããã ãã®ã¨ã³ããªã®å 容ã«ã¤ãã¦ã¯ãï¼ãã®ã¾ã¾ã§ã¯ããã¾ãããï¼githubã«ããã¦ããã®ã§åèã«ãã¦ä¸ããã ã¾ããHMRãå«ããç°å¢ã®ã»ããã¢ããã¯Reactéçºç°å¢ãæ§ç¯ããæã«åºã¦ããbabelãwebpack
// es5 'use strict'; var webpack = require('webpack'); var path = require('path'); var env = process.env.NODE_ENV; var config = { module: { loaders: [ { test: /\.js$/, loaders: ['babel-loader?presets[]=react&presets[]=es2015&cacheDirectory'], exclude: /node_modules/ }, { // ä»åã¯Scssã使ãã®ã§.scssã¨ãã¦ãã¾ãã // cssãç´æ¥ä½¿ãå ´åã¯.cssã¨ãã¦ãloadersããsassãé¤ãã¾ãã test: /\.scss$/, loaders: ['style', 'css', 'sass'] }, ] },
2017å¹´çã¨2018å¹´çã§webã¢ããªã±ã¼ã·ã§ã³ä½ææã®reactã®ï¼ãã¤ï¼ãã¹ããã©ã¯ãã£ã¯ã¹ã以ä¸ã®ãªãã¸ããªã«ãã¾ã¨ãã¦ã¿ãã®ã§è¨äºã«ãã¦ã¿ã¾ããã react-best-practices https://github.com/wheatandcat/react-best-practices/tree/master ã¡ãªã¿ã«ã¿ã¤ãã«ã¯ããã®éç¨ã§2018å¹´çã«åé¤ããpackageã§ãï¼çç±ã¯å¾è¿°ï¼ github ãµã³ãã«ã³ã¼ãã®å 容ã¯ããã°ã¤ã³/ãã°ã¢ã¦ã + fetchããå 容ãç»é¢ã«è¡¨ç¤ºããã ãã§ã ï¼ãã ã®ãµã³ãã«ãªã®ã§ãå®è£ ã¯ããªããã§ãï¼ 2017å¹´ç https://github.com/wheatandcat/react-best-practices/tree/master/2017years 2018å¹´ç https://github.com/wheatandc
jsã®configãã¡ã¤ã«ãæ¬çªç°å¢ã¨éçºç°å¢ã§éãå ´åãããã¾ãã ãããconfigãã¡ã¤ã«ãå«ãã ãã¡ã¤ã«ããã«ãããå ´åãphpã®ããã«.envã§åããã¿ãããªãã¨ãåºæ¥ã¾ããã ããã§ãæ¬çªç°å¢ç¨ã«ãã«ãããæã¨ãéçºç°å¢ç¨ã«ãã«ãããæã§ã³ãã³ããåãããã¨ã§ããã®åé¡ã解æ¶ããã¾ãã ãã®åããæ¹æ³ã«ã¯å¤§ããï¼ã¤ã®æ¹æ³ãããã¾ãã ç¶æ³ã«å¿ãã¦ä½¿ãåãã¦ããã ããã°ã¨æãã¾ãã ç¬ç«ããè¨å®ãã¡ã¤ã«ãä½ãæ¹æ³ webpackã¯ããã©ã«ãã§ã¯webpack.config.jsã¨ãããã¡ã¤ã«ã«è¨å®ãå®ç¾©ãã¾ãã ãããéçºç¨ã¨æ¬çªç¨ã§ãã¡ã¤ã«ãåãã¦å¥ã ã«å®è¡ãã¾ãã ä¾ãã° éçºç¨ã¯webpack.dev.js æ¬çªç¨ã¯webpack.prod.js ã§å¥ã ã«ä½ãã¾ãã ããã¦ãã«ãããæ㯠éçºç¨ãªãwebpack --config webpack.dev.js æ¬çªç¨ãªãw
How to make your Webpack builds 10x faster ãwebpackãã«ãã10åéãããæ¹æ³ãã¨ããã¹ã©ã¤ããè¦ã¤ããã å 容ãè¦ç´ããã¨ããããªæãã css-loaderã¯0.15æªæºã使ã cacheDiretoryã¯ããã©ã«ãã§ç¡å¹ã ããæå¹ã«ãã HappyPackã使ã DLLãã³ãã«ã使ã£ã¦ãéçã³ã¼ãã®ãã³ãã«ãåãã DLLãã³ãã«ã¯èãããã¨ããªãã£ãã®ã§èª¿ã¹ãã DLLãã³ãã«ã¨ã¯ Dll bundles doesn't execute any of your module's code. They only include modules. ã¢ã¸ã¥ã¼ã«ãã¾ã¨ããã ãã®bundleã§ãscriptã¿ã°ã§èªã¿è¾¼ãã æç¹ã§ã¯å«ã¾ããã¢ã¸ã¥ã¼ã«ã¯å®è¡ããããä»ã®bundleããåç §ãããæã«å®è¡ãããã
JavaScriptã®ãã¹ãç°å¢æ§ç¯(Mocha + power-assert + Karma + babel + webpack)JavaScriptmochakarmapower-assert ãã®è¨äºã¯ãåãã¦JavaScriptã®ãã¹ãç°å¢ãä½ã£ã¦ã¿ãããããã«ãããããããJavaScriptã®ãã¹ããæ¸ãã¦ãããããã©ãç»å ´äººç©ãå¤ããã¦ãªã«ããããã©ããããã¨æã£ã¦ããæ¹ã«åããè¨äºå ¼åå¿é²ã§ãã åãã¦ã®JavaScriptãã¹ãç°å¢æ§ç¯ã§ä¸å¿å ¬å¼ããã¥ã¡ã³ãã«ç®ãéãããã©è±èªã®æå³ãã¡ããã¨èªã¿åãã¦ãããããã¼ã«ãã©ã¤ãã©ãªã®ç解ã使ãæ¹ãééã£ã¦ããå ´åãããã¾ãã®ã§ã¢ããã¤ã¹ããã ããã¨å¹¸ãã§ãã åãã¹ããã¼ã«ãã©ã¤ãã©ãªã®ç´¹ä» JavaScriptã®ãã¹ãç°å¢ãæ§ç¯ããã¨ãã®ä¸ã¤ç®ã®å£ããã¼ã«ãã©ã¤ãã©ãªãããããåºã¦ãã¦ãã©ãã使ã£ã¦ãããããããªã/ããã
æ¦è¦ ã¿ãªãããWebéçºã§æ¶èãã¦ããªãã§ããããï¼ ä»åã¯SassãES2015ãbrowser-syncãwebpackã§ã¾ã¨ãã¦ç®¡çãã¦Webéçºãã¹ãã¼ãã«ããããã®æ¹æ³ãã¾ã¨ãã¦ã¿ã¾ããã å®éã«å®æããéçºç°å¢ã¯ãã¡ãã«ãªãã¾ãã 使ãããã ãã®æ¹ã¯ã¯ãã¼ã³ãã¦ä½¿ã£ã¦ãã ããã åä½ã®èª¬æã¯readme.mdæ¸ãã¦ããäºå®ã§ãããããè¨è¿°ãã¦ãªããã°ãã®è¨äºãåèã«ããªãã使ã£ã¦ãã ããã åä½ç°å¢ macOS Sierra (10.12.4) node.js yarn ãã£ã¬ã¯ããªæ§æ public å®éã«å ¬éããããã£ã¬ã¯ããªã localhostçã§ç¢ºèªããã¨ãã¯ãããã«å ¥ã£ã¦ããindex.htmlã表示ããã¾ãã ã¾ããsrcã®ãã¼ã¿ãã¾ã¨ããbundle.jsãããã«æ ¼ç´ããã¾ãã src ããã«/css/ã/js/ã¨ãã£ããã£ã¬ã¯ããªãä½ã£ã¦ä½æ¥ãã¦ããã¾ãã
kintone Advent Calender 9æ¥ç®ã®è¨äºã§ãã æè¿ã社å ã§ãããã¼ã¨ãããã¼ã¯ã¼ãããã使ããã¦ãããããªã®ã§ã¿ã¤ãã«ã«å ¥ãã¦ã¿ã¾ããã kintoneã§JavaScriptã®ã«ã¹ã¿ãã¤ãºããã¦ãã¦æãã®ã¯ãJavaScriptãã¡ã¤ã«ãã¢ãããã¼ãããã®ãé¢åãªãã§ãããã ããã§æ¹åã§ãããã¼ã«ä½ãã¾ãããï¼ã£ã¦æ¸ããã¨ããããåæ¥ã®æ¹ãåæ§ã®è¨äºãæ¸ããã¦ãã¾ããï½ ã¨ã¯è¨ãããã¯ãï¼æéçã«ï¼å¾æ»ãã¯ã§ããªãã®ã§ããç´¹ä»ããã¦é ãããã¨æãã¾ãã JavaScriptã«ã¹ã¿ãã¤ãºã®æµã kintoneã§JavaScriptã使ã£ãã«ã¹ã¿ãã¤ãºãè¡ãå ´åãã ããã以ä¸ã®ãããªæµãã§é²ãã¾ãã JavaScriptããã°ã©ã ãä½ã ã¢ããªã®è¨å®ç»é¢ããkintoneã¸JavaScriptãã¡ã¤ã«ãã¢ãããã¼ããã åä½ç¢ºèªã»ãããã°ãã 2ãè¡ãããã«ã¯kinto
TL;DR webpackã使ã£ã¦éçºç°å¢ã¨æ¬çªç°å¢ã§å¤ãéããã®ãã©ãå¤æ´ãããã(ex. url) import config from "config" console.log(`${config.url}`) // éçºç°å¢ã§ã¯ https://hoge.com // æ¬çªç°å¢ã§ã¯ https://fuga.com webpackã®resolve.aliasã使ç¨ãã webpackã®ããã¥ã¡ã³ã https://webpack.github.io/docs/configuration.html#resolve-alias resoleve.aliasã¯ã¢ã¸ã¥ã¼ã«ãä»ã®ã¢ã¸ã¥ã¼ã«ã¾ãã¯ãã¹ã§ç½®ãæãããã®ã webpack.config.js const environment = process.env.NODE_ENV || 'development'; const confi
æ稿æ¨é²é¨ã®å¤æï¼@hokacchaï¼ã§ãã ã¯ãã¯ãããããã°ã®éçºã§Railsä¸ã«ECMAScript6ãªã©ã®ã¢ãã³ãªJavaScriptéçºç°å¢ãå°å ¥ããçµé¨ãå ã«ãã¦ãã¦ãç´¹ä»ãããã¨æãã¾ãã Railsã¯Sprocketsã¨ããgemã§JavaScriptãCSSãã³ã³ãã¤ã«ããä»çµã¿ãæä¾ããã¦ãã¾ããSprocketsã«ããasset管çã®ä»çµã¿ã¯é常ã«ããã§ãã¦ãããAltJSã®ãã©ã³ã¹ãã¤ã«ããã¡ã¤ã«ã®çµåãminifyãªã©ãassetã®ã³ã³ãã¤ã«ã«å¿ è¦ãªæ©è½ãä¸éãåãã¦ãã¾ãã ããããJavaScriptã«ãããã¢ã¸ã¥ã¼ã«ã®ä¾åé¢ä¿ã®è§£æ±ºããã©ã¤ãã©ãªã®ç®¡çãªã©ã«ã¤ãã¦ã¯ã¢ãã³ãªJavaScriptéçºã¨ä¹é¢ãã¦ãã¦ããã®ãç¾ç¶ã§ããããã§ãRailsã§ã以ä¸ã®ãããªãã¨ãå®ç¾ã§ãããã¨ãç®æ¨ã«ç°å¢ãä½ãã¾ããã ECMAScript6ã®ã·ã³ã¿ãã¯ã¹ã使ã ã¢ã¸ã¥
ããã«ã¡ã¯ãç§äºã§ããããµã¤ããªãã¥ã¼ã¢ã«ã«ä¼´ããã åãå¤ããããå çãã¨ãªãã¾ãããï¼å åå£«ï¼ éæ ¼ã«ãªã£ã訳ã§ã¯ããã¾ããã馴æã¾ãªãã£ãã ãã§ãã ãã¦ãES5ã®ãã©ã¦ã¶å¯¾å¿ãåºã¾ããES6ã®è©±é¡ãã¡ãã»ãã¨åºå§ãã¾ããã ES6ã§ã¯ClassãConstãå ãããã¨ã¨ãªããããã¾ã§ã®JavaScriptã®æ¸ãæ¹ãå¤ãã£ã¦ãããã¨ã§ãããã ã¨ããããã§æ©éES6ã§ã³ã¼ããæ¸ãã¦ã¿ããã¨æãã¾ãããæ®éã«æ¸ããã®ã§ã¯åããªããã©ã¦ã¶ãå¤æ°ã§ãã ããã§æ¬æ¥ã¯ãWebPackã¨ES6-Loaderã使ããES6ã§æ¸ãã¤ã¤ãES5ã«ã³ã³ãã¼ãããã¦ããæé ãç´¹ä»ãããã¨æãã¾ãã ã¤ã³ã¹ãã¼ã«ã®åã«éçºãã£ã¬ã¯ããªãä½ãã¾ããä»åã¯ãããªæãã«ãã¾ãã /es6 ⣠/node_modules ⣠/source â package.json Node.js npmã使ããç¶æ ã«ãªã£ã¦ã
ã¯ããã« ãã¤ãã¯es6ã®ã¢ã¸ã¥ã¼ã«ç®¡çæ¹å¼ã§ããimport/export(ES modules)ã使ã£ã¦ãnpmã§æã«å ¥ããã©ã¤ãã©ãªãèªåã§ä½æããã¢ã¸ã¥ã¼ã«ããã¼ããã¦ãããããã¾ã«æã£ãæåã«ãªããªããã¨ããããã¾ããexport defaultããã¢ã¸ã¥ã¼ã«ããã¹ããããã¨ãã¦karmaã§require()ããã¨ã¨ã©ã¼ã«ãªã£ãããããããããå ´åã¯ãã¨ããããmodule.exportsã使ã£ã¦ã¿ãã¨ãã¾ããã£ãããããã¨ãå¤ãã®ã ãããªããªã®ãã¯ãã¾ãèãã¦ããªãã£ãã ã¨ãããã¨ã§ãå®éã«ã¯ã©ããªã£ã¦ããã®ããã¾ãã¢ã¸ã¥ã¼ã«ã·ã¹ãã ã¨ã¯ä½ãªã®ãã¨ããç¹ã§åºæ¬çãªãã¨ããç解ãæ·±ãã¦ães6ã®import/exportã¨ã®éããç¥ããããæ£ããå®è£ ã§ããããã«ãªãã°è¯ãã¨æã£ã¦ããã çµè«ã¨ãã¦ã¯ æ¹éã¨ãã¦ã¯åºæ¬çã«ã¯ES6å½¢å¼ã§è¨è¿°ããããCommonJSå½¢å¼ã®èªã¿æ¸ãã
ã¹ã©ã¤ãã¡ãã¥ã¼ã®å®è£ ã« sp-slidemenu ã fixed 対å¿ãã以ä¸ã®ã©ã¤ãã©ãªã使ç¨ããã github.com ãã®ã©ã¤ãã©ãªã¯ npm ã«ã bower ã«ãç»é²ããã¦ããªãã bower.json ãããã° bower install ãå¯è½ã ããããç¡ãã®ã§ npm 㧠github ã®ãã¹ãæå®ãã¦ã¤ã³ã¹ãã¼ã«ããã â» git submodule ã¯ãªãã¬ã¼ã·ã§ã³ã®é¢ä¿ã§ä»å使ããªãã $ npm install --save-dev git://github.com/tokunagakazuya/sp-slidemenu#0.1.2-release â¼ ã¤ã³ã¹ãã¼ã«ãæåããã¨ãnode_modules ç´ä¸ã« sp-slidemenu.js ãã£ã¬ã¯ããªãåºæ¥ãã node_modules/sp-slidemenu.js/ ââGruntfile.js âââ
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}