More selective imports
This commit is contained in:
@ -17,13 +17,18 @@ const router = new Router();
|
||||
// }
|
||||
// });
|
||||
|
||||
// Frontend
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
router.get('/service-worker.js', async (ctx) => {
|
||||
ctx.set('Content-Type', 'application/javascript');
|
||||
const stats = await sendfile(ctx, path.join(__dirname, 'static/service-worker.js'));
|
||||
if (!ctx.status) ctx.throw(httpErrors.NotFound());
|
||||
});
|
||||
|
||||
router.get('/static/*', async (ctx) => {
|
||||
const stats = await sendfile(ctx, path.join(__dirname, '../dist/', ctx.path.substring(8)));
|
||||
});
|
||||
}
|
||||
|
||||
router.get('*', async (ctx) => {
|
||||
const stats = await sendfile(ctx, path.join(__dirname, './static/dev.html'));
|
||||
if (!ctx.status) ctx.throw(httpErrors.NotFound());
|
||||
|
@ -1,3 +1,3 @@
|
||||
// https://github.com/reactjs/react-router/blob/master/docs/guides/NavigatingOutsideOfComponents.md
|
||||
import { browserHistory } from 'react-router';
|
||||
import browserHistory from 'react-router/lib/browserHistory';
|
||||
export default browserHistory;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { Provider } from 'react-redux';
|
||||
import { Router, Route, IndexRoute } from 'react-router';
|
||||
import Router from 'react-router/lib/Router';
|
||||
import Route from 'react-router/lib/Route';
|
||||
import IndexRoute from 'react-router/lib/IndexRoute';
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { routerMiddleware } from 'react-router-redux';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
|
Reference in New Issue
Block a user