标签云

微信群

扫码加入我们

WeChat QR Code

I'm currently building an express app that uses webpack and in order to avoid duplicate files being created (multiple indexes etc.) I'm sending bundled webpack assets through a proxy.I have the following route:app.all('/assets/*', function (req, res) {console.log('foo');proxy.web(req, res, {target: 'http://127.0.0.1:3001'});});The foostatement is triggered when I visit http://localhost:3000/assets/ but NOT when I visit http://localhost:3000/assets/styles.cssEven weirder, when I change my SASS files to generate a new styles.css and visit http://localhost:3001/assets/styles.css the updated CSS is present but not when visiting the same file on :3000 (which I guess kinda makes sense if the proxy isn't being fired...)I'm not gonna lie, this is seriously freaking me out and some hair is about to get pulled out :)


Can you show your other middleware you're using? It's possible that something else is handling that request before it makes it to this one.

2019年04月18日33分41秒

^ I.e., your sass middleware might be intercepting and handling the request before it makes it to this one.

2019年04月18日33分41秒

There actually isn't any other than my bundler process (which commented out still has the same issue)... I'm at bare-bones app stage pretty much.

2019年04月19日33分41秒

Hmm, it might still be useful to see your other code. You have to at least have some sort of a static file handler in there if the .css files are getting served up at all. I can't say for certain that's what's interfering without seeing more code, though.

2019年04月18日33分41秒

I know this is probably a little cheeky, but here's the repo: leakybitbucket.org/leaky/webpack-express.git

2019年04月19日33分41秒