parcel-bundler / website

🌎 Parcel website
https://parceljs.org
MIT License
351 stars 466 forks source link

Document serving static files #655

Open mischnic opened 4 years ago

mischnic commented 4 years ago

From @subuta in https://github.com/parcel-bundler/parcel/issues/3407#issuecomment-686247350:

Create .proxyrc.js with these contents.

const serveStatic = require('serve-static')

module.exports = function (app) {
  // Use static middleware
  app.use(serveStatic('static'))
}

Then you may access your static file like this http://localhost:1234/test.txt

tj commented 4 years ago

ah damn it's v2, which seems broken :'(

mischnic commented 4 years ago

broken

?

tj commented 4 years ago

I just get Name already registered with serializer, which seems to still be an open bug

subuta commented 4 years ago

@mischnic Thanks for your advice and quoting in here :)

As an additional information, my environments are following. and it works at least for me. Sorry if I missing something important at original thread(or here). https://github.com/parcel-bundler/parcel/issues/3407#issuecomment-686247350

natejenkins commented 3 years ago

Took me a while to realize I also needed to npm install serve-static to get the example proxyrc file working.