_headers & _redirects generation (#240)

* Generate `_headers` and `_redirects` by passing assets through ejs templates.

* PR feedback

* Excluding service worker stuff from prerender

* Build SW in dev

* Let's give this a try

* lol

* Is this how it works?
This commit is contained in:
Jason Miller
2018-11-09 13:49:01 -05:00
committed by Jake Archibald
parent 9b572f9541
commit 6994cc3d15
6 changed files with 100 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
const WorkerPlugin = require('worker-plugin');
const AutoSWPlugin = require('./config/auto-sw-plugin');
const CrittersPlugin = require('critters-webpack-plugin');
const AssetTemplatePlugin = require('./config/asset-template-plugin');
function readJson (filename) {
return JSON.parse(fs.readFileSync(filename));
@@ -238,8 +239,11 @@ module.exports = function (_, env) {
compile: true
}),
new AutoSWPlugin({
version: VERSION
new AutoSWPlugin({ version: VERSION }),
isProd && new AssetTemplatePlugin({
template: path.join(__dirname, '_headers.ejs'),
filename: '_headers',
}),
new ScriptExtHtmlPlugin({