diff --git a/config/routes.json b/config/routes.json index f4abd3f8d1..8e7fb4b9ca 100644 --- a/config/routes.json +++ b/config/routes.json @@ -4,6 +4,11 @@ "controller": "SettingsManager", "action": "find", "policies": [] + }, + "GET /plugins/settingsmanager/:file": { + "controller": "SettingsManager", + "action": "file", + "policies": [] } } } diff --git a/controllers/SettingsManager.js b/controllers/SettingsManager.js index e6638cf29f..27fffff4b5 100644 --- a/controllers/SettingsManager.js +++ b/controllers/SettingsManager.js @@ -1,5 +1,8 @@ 'use strict'; +const sendfile = require('koa-sendfile'); +const path = require('path'); + /** * A set of functions called "actions" for `SettingsManager` */ @@ -8,6 +11,11 @@ module.exports = { find: function *() { this.body = []; + }, + + file: function *() { + yield sendfile(this, path.resolve(__dirname, '..', 'public', 'build', this.params.file)); + if (!this.status) this.throw(404); } }; diff --git a/public/internals/webpack/webpack.prod.babel.js b/public/internals/webpack/webpack.prod.babel.js index d369390283..95cbc1ac6e 100644 --- a/public/internals/webpack/webpack.prod.babel.js +++ b/public/internals/webpack/webpack.prod.babel.js @@ -18,7 +18,7 @@ module.exports = require('./webpack.base.babel')({ // Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets output: { - filename: '[name].[chunkhash].js', + filename: '[name].js', chunkFilename: '[name].[chunkhash].chunk.js', },