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

Document serving static files #655

Open
mischnic opened this issue Sep 3, 2020 · 5 comments
Open

Document serving static files #655

mischnic opened this issue Sep 3, 2020 · 5 comments

Comments

@mischnic
Copy link
Member

mischnic commented Sep 3, 2020

From @subuta in parcel-bundler/parcel#3407 (comment):

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
Copy link

tj commented Sep 4, 2020

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

@mischnic
Copy link
Member Author

mischnic commented Sep 4, 2020

broken

?

@tj
Copy link

tj commented Sep 4, 2020

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

@subuta
Copy link

subuta commented Sep 7, 2020

@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). parcel-bundler/parcel#3407 (comment)

  • Node.js v10.16.3
  • parcel@2.0.0-beta.1 (installed by npm i parcel@next -D command)
  • serve-static@1.14.1 (installed by npm i serve-static command)

@natejenkins
Copy link

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

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

4 participants