ff-stream-web

git clone git://archive.git.mtrnord.blog/MTRNord/ff-stream-web.git
Log | Files | Refs | README | LICENSE

commit 860a403f2483f111f7748ba36aa088af82b5daa6
parent 7e8b4f2dac3aea84c9343bfb52021273705f377d
Author: Konstantin Tarkus <hello@tarkus.me>
Date:   Sat, 20 Feb 2016 15:50:00 +0300

Improve browser detection in core/Location component

Diffstat:
Msrc/core/Location.js | 3+--
Mtools/webpack.config.js | 4++--
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/core/Location.js b/src/core/Location.js @@ -7,11 +7,10 @@ * LICENSE.txt file in the root directory of this source tree. */ -import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment'; import createHistory from 'history/lib/createBrowserHistory'; import createMemoryHistory from 'history/lib/createMemoryHistory'; import useQueries from 'history/lib/useQueries'; -const location = useQueries(canUseDOM ? createHistory : createMemoryHistory)(); +const location = useQueries(process.env.BROWSER ? createHistory : createMemoryHistory)(); export default location; diff --git a/tools/webpack.config.js b/tools/webpack.config.js @@ -120,7 +120,7 @@ const clientConfig = extend(true, {}, config, { // http://webpack.github.io/docs/configuration.html#devtool devtool: DEBUG ? 'cheap-module-eval-source-map' : false, plugins: [ - new webpack.DefinePlugin({ ...GLOBALS, 'process.env.BROWSER': '"true"' }), + new webpack.DefinePlugin({ ...GLOBALS, 'process.env.BROWSER': true }), new AssetsPlugin({ path: path.join(__dirname, '../build'), filename: 'assets.js', @@ -174,7 +174,7 @@ const serverConfig = extend(true, {}, config, { }, devtool: 'source-map', plugins: [ - new webpack.DefinePlugin({ ...GLOBALS, 'process.env.BROWSER': '"false"' }), + new webpack.DefinePlugin({ ...GLOBALS, 'process.env.BROWSER': false }), new webpack.BannerPlugin('require("source-map-support").install();', { raw: true, entryOnly: false }), ],