get tests passing again

This commit is contained in:
Rich Harris
2018-08-25 14:01:07 -04:00
parent 9cbb8bdc33
commit 200c5fcbd2
5 changed files with 5 additions and 7 deletions

View File

@@ -76,7 +76,7 @@ async function execute(emitter: EventEmitter, {
if (serviceworker) {
create_serviceworker_manifest({
routes: route_objects,
client_files: client_result.assets.map((chunk: { name: string }) => `client/${chunk.name}`)
client_files: client_result.assets.map((file: string) => `client/${file}`)
});
serviceworker_stats = await serviceworker.compile();

View File

@@ -268,7 +268,7 @@ class Watcher extends EventEmitter {
fs.writeFileSync(path.join(dest, 'client_assets.json'), JSON.stringify(result.assetsByChunkName, null, ' '));
this.deferreds.client.fulfil();
const client_files = result.assets.map((chunk: { name: string }) => `client/${chunk.name}`);
const client_files = result.assets.map((file: string) => `client/${file}`);
create_serviceworker_manifest({
routes: create_routes(),

View File

@@ -17,7 +17,7 @@ export class CompileResult {
duration: number;
errors: CompileError[];
warnings: CompileError[];
assets: Array<{ name: string }>;
assets: string[];
assetsByChunkName: Record<string, string>;
}
@@ -64,7 +64,7 @@ class WebpackResult extends CompileResult {
this.duration = info.time;
this.assets = info.assets.map((chunk: { name: string }) => `client/${chunk.name}`);
this.assets = info.assets.map((chunk: { name: string }) => chunk.name);
this.assetsByChunkName = info.assetsByChunkName;
}

View File

@@ -56,8 +56,6 @@ function generate_client(
const server_routes_to_ignore = routes.server_routes.filter(route =>
!page_ids.has(route.pattern.toString()));
const len = Math.max(...routes.components.map(c => c.name.length));
let code = `
// This file is generated by Sapper — do not edit it!
import root from '${get_file(path_to_routes, routes.root)}';

View File

@@ -484,7 +484,7 @@ function get_page_handler(
let scripts = []
.concat(chunks.main) // chunks main might be an array. it might not! thanks, webpack
.filter(file => !file.match(/\.map$/))
.map(file => `<script type="module" src='${req.baseUrl}/client/${file}'></script>`)
.map(file => `<script src='${req.baseUrl}/client/${file}'></script>`)
.join('');
let inline_script = `__SAPPER__={${[