always write to .sapper, not templates, since we cant guarantee fs access

This commit is contained in:
Rich Harris
2017-12-17 15:04:20 -05:00
parent 8b50ff34b8
commit b7ac067459
3 changed files with 8 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
const fs = require('fs');
const path = require('path');
const { dest, main_built, server_routes, dev } = require('../config.js');
const { dest, server_routes, dev } = require('../config.js');
module.exports = function create_app(src, dest, routes, options) {
function create_client_main() {
@@ -23,11 +23,13 @@ module.exports = function create_app(src, dest, routes, options) {
.replace(/__routes__/g, code)
.replace(/__dev__/g, String(dev));
fs.writeFileSync(main_built, main);
const file = path.resolve(dest, 'main.js');
fs.writeFileSync(file, main);
// need to fudge the mtime, because webpack is soft in the head
const stats = fs.statSync(main_built);
fs.utimesSync(main_built, stats.atimeMs - 999999, stats.mtimeMs - 999999);
const stats = fs.statSync(file);
fs.utimesSync(file, stats.atimeMs - 999999, stats.mtimeMs - 999999);
}
function create_server_routes() {