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

RFC: Serve sku-generated static files when server rendering locally #57

Closed
mengtzu opened this issue Sep 5, 2017 · 1 comment
Closed
Assignees
Labels

Comments

@mengtzu
Copy link
Contributor

mengtzu commented Sep 5, 2017

Summary

Static files (eg main.js, styles.css) generated into the specified dist folder should be served by the supplied express server without further configuration. This is a setting for development, not production builds.

Motivation

Without this, unless the appropriate express.static call is passed into middleware, requests for static files will fall into the render function fallback. In a typical case this would cause the app to return a rendered 404 html page instead of the js or css requested.

Detailed design

In config/server/server.js, after the express app is instantiated but before the render function fallback, we should include a line much like the following:

app.use(express.static(path.join(__dirname, './')));

How We Teach This

This should cause local server rendering to work as expected, and should not require teaching.

Drawbacks

This is not limited to sku-generated static files, if the server finds any others in its root it'll happily serve them too. That's still probably behaving as expected.

Alternatives

You can just pass this in manually as middleware, that just seems like an odd thing to require.

Unresolved questions

Is it worth creating a static folder for this purpose?

@mengtzu mengtzu self-assigned this Sep 5, 2017
@markdalgleish markdalgleish changed the title RFC: serve sku-generated static files when server rendering locally RFC: Serve sku-generated static files when server rendering locally Sep 5, 2017
@nicolassenechal
Copy link
Contributor

Implemented in #59

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

No branches or pull requests

3 participants