Mastering React by 2016

Mastering React by 2016

Author:2016
Language: eng
Format: mobi, epub
Publisher: Packt Publishing


Babel is separated completely into submodules as of version 6. This means that, without these other modules, Babel will do nothing to transform the files. The Babel submodules are called presets in Babel parlance. Here we have included the react preset, which handles the JSX compilation, and the es2015 preset, which provides all of our ES6 goodness.

Ahead of the Babel and react-hot loaders is the reflux-wrap-loader. The source for this loader should be located in the file web_modules/reflux-wrap-loader/index.js. Go ahead and make this directory structure, and use the code listing below for the index.js file inside the reflux-wrap-loader directory. Webpack automatically searches the node_modules and web_modules directories for loaders. The reflux-wrap-loader is a simple example of a loader.

module.exports = function (source) { this.cacheable && this.cacheable(); var newSource; if (/reflux-core.*index.js$/.test(this.resourcePath)) { newSource = ";import RefluxPromise from 'reflux-promise';\n"; newSource += source; newSource += ";\nReflux.use(RefluxPromise(Promise));"; } return newSource || source; };



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.