Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entries only from first config object are served #225

Closed
IskanderMustafin opened this issue Jul 16, 2017 · 2 comments
Closed

Entries only from first config object are served #225

IskanderMustafin opened this issue Jul 16, 2017 · 2 comments

Comments

@IskanderMustafin
Copy link

IskanderMustafin commented Jul 16, 2017

When using webpack.config with multiple targets, only files from first configuration are served. For files from second config I'm getting 404 error.

const webpack = require('webpack');
const path = require('path');

module.exports = [


	{
        name: 'mobile',
        entry: {
           
            mobile: ['webpack-hot-middleware/client?name=mobile', './mobile.js']
            
        },
		
		output: {
			path: path.join(__dirname, 'build', 'mobile'),
			filename: '[name].js',
			publicPath: '/'
		}

    },
	
	{
        name: 'desktop',
        entry: {
          
            desktop: ['webpack-hot-middleware/client?name=desktop', './desktop.js']
        },
		
		output: {
			path: path.join(__dirname, 'build', 'desktop'),
			filename: '[name].js',
			publicPath: '/'
		},

    }
    
  
]

If I swap configs places (i.e. move desktop to be first element of array and mobile is second) then I can request files only for desktop bundle.

After some testing, I understood that if I delete publicPath from first config, then bundle only from 2nd config is served.

Conclusion: . webpack-hot-middleware serves only entries defined in first config (of array
of configs) with puclicPath property included.

P.S.: On express side I have this:

app.use(require("webpack-dev-middleware")(compiler, {
    noInfo: true, publicPath: "/"
}));

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

 
@glenjamin
Copy link
Collaborator

I'd need to see more of your config to help.

Hot middleware itself doesn't serve up any of your files - that's dev-middleware' job. So the problem will be config related

@IskanderMustafin
Copy link
Author

IskanderMustafin commented Jul 16, 2017

This issue is related to this:

webpack/webpack-dev-middleware#151
webpack/webpack-dev-server#641

Closing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants