-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Webpack config in dev and prod include copywebpack for static transla… #1491
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
Changes from 1 commit
78f87b6
348056e
c31a65a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,11 +75,11 @@ app.use(corsMiddleware); | |
app.options('*', corsMiddleware); | ||
|
||
// Body parser, cookie parser, sessions, serve public assets | ||
|
||
app.use('/translations', Express.static('translations/locales/')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The path needs to point to the location of the copied translations...
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @catarak, you're right that L79 will serve For now, we're not versioning the translations assets using a content hash in the filename so we should serve them from In future we should probably use the same content-hash-in-filename strategy for these files too, but it's a bit more complex so this is a fix in the short-term that gets staging working again. @oruburos this line (L78) needs to be: app.use(
'/locales',
Express.static(
path.resolve(__dirname, '../dist/static/locales'),
{
// Browsers must revalidate for changes to the locale files
// It doesn't actually mean "don't cache this file"
// See: https://jakearchibald.com/2016/caching-best-practices/
setHeaders: res => res.setHeader('Cache-Control', 'no-cache')
}
)
); |
||
app.use(Express.static(path.resolve(__dirname, '../dist/static'), { | ||
maxAge: process.env.STATIC_MAX_AGE || (process.env.NODE_ENV === 'production' ? '1d' : '0') | ||
})); | ||
app.use('/translations', Express.static('translations/locales/')); | ||
|
||
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); | ||
app.use(bodyParser.json({ limit: '50mb' })); | ||
app.use(cookieParser()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should stay as
'/translations/{{lng}}/translations.json'
, but the static file config inserver/server.js
needs to change...