mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
Merge pull request #596 from sveltejs/recover-alpha-10
various lost changes and fixes from 0.26.0-alpha.10
This commit is contained in:
@@ -199,9 +199,10 @@ class Watcher extends EventEmitter {
|
||||
});
|
||||
|
||||
manifest_data = new_manifest_data;
|
||||
} catch (err) {
|
||||
} catch (error) {
|
||||
this.emit('error', <ErrorEvent>{
|
||||
message: err.message
|
||||
type: 'manifest',
|
||||
error
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -408,11 +409,11 @@ class Watcher extends EventEmitter {
|
||||
}) {
|
||||
compiler.oninvalid(invalid);
|
||||
|
||||
compiler.watch((err?: Error, result?: CompileResult) => {
|
||||
if (err) {
|
||||
compiler.watch((error?: Error, result?: CompileResult) => {
|
||||
if (error) {
|
||||
this.emit('error', <ErrorEvent>{
|
||||
type: name,
|
||||
message: err.message
|
||||
error
|
||||
});
|
||||
} else {
|
||||
this.emit('build', {
|
||||
|
||||
12
src/cli.ts
12
src/cli.ts
@@ -89,8 +89,16 @@ prog.command('dev')
|
||||
});
|
||||
|
||||
watcher.on('error', (event: ErrorEvent) => {
|
||||
console.log(colors.red(`✗ ${event.type}`));
|
||||
console.log(colors.red(event.message));
|
||||
const { type, error } = event;
|
||||
|
||||
console.log(colors.bold().red(`✗ ${type}`));
|
||||
|
||||
if (error.loc && error.loc.file) {
|
||||
console.log(colors.bold(`${path.relative(process.cwd(), error.loc.file)} (${error.loc.line}:${error.loc.column})`));
|
||||
}
|
||||
|
||||
console.log(colors.red(event.error.message));
|
||||
if (error.frame) console.log(error.frame);
|
||||
});
|
||||
|
||||
watcher.on('fatal', (event: FatalEvent) => {
|
||||
|
||||
@@ -153,7 +153,7 @@ export default function extract_css(client_result: CompileResult, components: Pa
|
||||
chunks_with_css.add(chunk);
|
||||
});
|
||||
|
||||
const entry = path.resolve(dirs.src, 'app.mjs');
|
||||
const entry = path.resolve(dirs.src, 'client.js');
|
||||
const entry_chunk = client_result.chunks.find(chunk => chunk.modules.indexOf(entry) !== -1);
|
||||
|
||||
const entry_chunk_dependencies: Set<Chunk> = new Set([entry_chunk]);
|
||||
|
||||
@@ -69,7 +69,7 @@ export type ReadyEvent = {
|
||||
|
||||
export type ErrorEvent = {
|
||||
type: string;
|
||||
message: string;
|
||||
error: Error;
|
||||
};
|
||||
|
||||
export type FatalEvent = {
|
||||
|
||||
Reference in New Issue
Block a user