Skip to content

Commit

Permalink
Improve browser detection in core/Location component
Browse files Browse the repository at this point in the history
  • Loading branch information
koistya committed Feb 20, 2016
1 parent 7e8b4f2 commit 860a403
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/core/Location.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
4 changes: 2 additions & 2 deletions tools/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 }),
],
Expand Down

0 comments on commit 860a403

Please sign in to comment.