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