1

I believe I have some simple issue with path or something similar in my app.

App Structure:
root/public/build      <-- publicPath in webpackConfig
root/public/index.html <-- Statically sitting there
root/client/           <-- client/angular2 source code
root/server/           <-- express/featherjs server

Contents of index.html

<html>
<head>
  <title>Angular Webpack</title>
</head>
<body>
  <app>Loading...</app>
  <script src="/build/vendor.bundle.js"></script>
  <script src="/build/bundle.js"></script>
</body>
</html>

webpackConfig: (entry and output sections only)

    entry: {
        'main': [
            'webpack/hot/dev-server',
            'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000',
            path.join(__dirname, 'client', 'bootstrap.ts')
        ],
        'vendor': [
            path.join(__dirname, 'client', 'vendor.ts'),
            'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000'
            ]
    },
    output: {
        path: path.join(__dirname, 'public/build'),
        filename: 'bundle.js',
        publicPath: '/build'
    },

webpack builds in public/build folder. Now, while express server running with webpack-hot-middleware configured, I can load the index page at localhost, but it throws 404 for the webpack scripts as below:

AngularWebpack

M.D.
  • 1,886
  • 1
  • 13
  • 14

0 Answers0