How to use webpack-dev-middleware with feathers / express?

I am trying to get a feathersjs application running using the actionjs interface. Using webpack-dev-middlewareand webpack-hot-middleware, I should simply expand the application of feathers with all of these materials in the development process. The only problem is always to get the 404 feathers page whenever I extract the js file from webpack.

Initially, my directory structure:

/feathers/public/index.html
/feathers/src/app.js
/react/src/index.js
/react/webpack.config.js
/react/develop.js

/feathers/src/app.js - this is the default application for feathers, serves for static files from a shared folder.

.use('/', serveStatic( app.get('public') ))

As /react/develop.jsI need the app to feathers and expand it with the intermediate web packages.

const app = require('../feathers/src/app');
const config = require('./webpack.config');
const path = require('path');
const webpack = require('webpack');

var compiler = webpack(config);

app.use(require('webpack-dev-middleware')(compiler, {
  publicPath: '/',
  stats: {colors: true},
}));

app.use(require('webpack-hot-middleware')(compiler));

const port = app.get('port');
const server = app.listen(port);
server.on('listening', () =>
  console.log(`Feathers application started on ${app.get('host')}:${port}`)
);

Unfortunately, this does not work at all. For reference, here is my/react/webpack.config.js

var webpack = require("webpack")

module.exports = {
  devtool: 'source-map',
  entry: [
    'webpack-hot-middleware/client',
    'src/index.js'
  ],
  output: {
    path: '/',
    filename: "bundle.js",
  },
  module: {
    loaders: [
      { test: /\.js$/, loader: "babel", exclude: /node_modules/, query: { presets: ['es2015', 'react', 'stage-0'] } },
      { test: /\.(svg|png|jpe?g|gif|ttf|woff2?|eot)$/, loader: 'url?limit=8182' },
    ]
  },
  resolve: {
    root: [
      __dirname,
      __dirname + '/src',
    ]
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin(),
  ]
}

AND /feathers/public/index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>React App</title>
</head>
<body>
  <div id="root"></div>
  <script src="bundle.js"></script>
</body>
</html>

publicPath, . , ? 2 . , , .

+4
1

, , webpack dev/hot middlewares , feathers/src/middleware/index.js, , Feathers notFound 404 Middleware!

, react/middleware.js, , webpack ( webpack ).

, !

+4

All Articles