setup webpack

This commit is contained in:
2017-01-22 10:51:08 -07:00
parent 74453d75fc
commit c85b2e2702
16 changed files with 3154 additions and 72 deletions

View File

@@ -1,5 +1,3 @@
'use strict';
module.exports = function enableAuthentication(server) {
// enable authentication
// server.enableAuth();

View File

@@ -1,7 +1,7 @@
const pingRoute = require('./routes/ping');
module.exports = function(server) {
var router = server.loopback.Router();
module.exports = (server) => {
const router = server.loopback.Router();
// Install a `/` route that returns server status
// router.get('/', server.loopback.status());

View File

@@ -0,0 +1,25 @@
const webpack = require('webpack');
const webpackMiddleware = require('webpack-dev-middleware');
const config = require('../config/webpack.dev');
const isProduction = (process.env.NODE_ENV === 'production');
module.exports = (app) => {
if (isProduction) return;
const compiler = webpack(config);
const middleware = webpackMiddleware(compiler, {
publicPath: config.output.publicPath,
contentBase: 'src',
stats: {
colors: true,
hash: false,
timings: true,
chunks: false,
chunkModules: false,
modules: false,
},
});
app.use(middleware);
};

View File

@@ -0,0 +1,13 @@
const webpack = require('webpack');
const webpackHotMiddleware = require('webpack-hot-middleware');
const config = require('../config/webpack.dev');
const isProduction = (process.env.NODE_ENV === 'production');
module.exports = (app) => {
if (isProduction) return;
const compiler = webpack(config);
app.use(webpackHotMiddleware(compiler));
};