Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Commit

Permalink
fix: sourcemap support for browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Hurpeau committed Feb 20, 2017
1 parent 5e4ae7d commit c5d3c3f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/build/webpack.config.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,12 @@ export default function clientConfig(options) {
entry: appResolve(options.client.serviceWorker),
}),
].filter(Boolean),
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
// fs and module are used by source-map-support
node: {
fs: 'empty',
module: 'empty',
},
}, concat);
}
5 changes: 5 additions & 0 deletions src/client/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { browserHistory } from 'react-router';
import { useBasename } from 'history';
import RedBox from 'redbox-react';
import { Resolver } from 'react-resolver';
import { install as installSourceMapSupport } from 'source-map-support';

/* eslint-disable import/no-extraneous-dependencies */
import routes from '__app_modules__routes__';
Expand All @@ -19,6 +20,10 @@ import App from './components/App';
// eslint-disable-next-line import/no-extraneous-dependencies
const reducers = require('__app_modules__redux_reducers__');

if (process.env.NODE_ENV !== 'production') {
installSourceMapSupport({ environment: 'browser' });
}

function render(history, store, appRoutes, element) {
const insertCss = ({ _insertCss }) => _insertCss();
Resolver.render(
Expand Down

0 comments on commit c5d3c3f

Please sign in to comment.