mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 19:45:26 +00:00
fix prod mode
This commit is contained in:
@@ -62,6 +62,8 @@ module.exports = function connect(opts) {
|
||||
'Cache-Control': 'max-age=31536000'
|
||||
});
|
||||
res.end(compiler.asset_cache[url]);
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ module.exports = function create_compiler(client, server, dest, routes, dev) {
|
||||
compiler.client_main = `/client/${info.assetsByChunkName.main}`;
|
||||
compiler.assets = info.assets.map(asset => `/client/${asset.name}`);
|
||||
|
||||
const fs = client.outputFileSystem;
|
||||
const _fs = client.outputFileSystem && client.outputFileSystem.readFileSync ? client.outputFileSystem : fs;
|
||||
compiler.asset_cache = {};
|
||||
compiler.assets.forEach(file => {
|
||||
compiler.asset_cache[file] = fs.readFileSync(path.join(dest, file), 'utf-8');
|
||||
compiler.asset_cache[file] = _fs.readFileSync(path.join(dest, file), 'utf-8');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -137,7 +137,11 @@ module.exports = function create_compiler(client, server, dest, routes, dev) {
|
||||
|
||||
new Promise((fulfil, reject) => {
|
||||
server.run((err, stats) => {
|
||||
server_updated(err, stats, reject);
|
||||
if (stats.hasErrors()) {
|
||||
reject(stats.toJson().errors[0]);
|
||||
} else {
|
||||
server_updated(stats);
|
||||
}
|
||||
fulfil();
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user