update for 0.22

This commit is contained in:
Rich Harris
2018-09-30 21:17:30 -04:00
parent d9c493b2ba
commit 6105607a17
6 changed files with 48 additions and 36 deletions

View File

@@ -1,7 +1,5 @@
import { init } from 'sapper/runtime.js';
import { manifest } from './manifest/client.js';
import * as sapper from '../__sapper__/client.js';
init({
target: document.querySelector('#sapper'),
manifest
sapper.start({
target: document.querySelector('#sapper')
});

View File

@@ -1,8 +1,7 @@
import sirv from 'sirv';
import polka from 'polka';
import sapper from 'sapper';
import compression from 'compression';
import { manifest } from './manifest/server.js';
import * as sapper from '../__sapper__/server.js';
const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';
@@ -11,7 +10,7 @@ polka() // You can also use Express
.use(
compression({ threshold: 0 }),
sirv('static', { dev }),
sapper({ manifest })
sapper.middleware()
)
.listen(PORT, err => {
if (err) console.log('error', err);

View File

@@ -1,9 +1,9 @@
import { timestamp, assets, shell, routes } from './manifest/service-worker.js';
import { timestamp, files, shell, routes } from '../__sapper__/service-worker.js';
const ASSETS = `cache${timestamp}`;
// `shell` is an array of all the files generated by webpack,
// `assets` is an array of everything in the `assets` directory
// `files` is an array of everything in the `static` directory
const to_cache = shell.concat(assets);
const cached = new Set(to_cache);