fix(tauri/examples): fix build errors (#1218)

This commit is contained in:
Noah Klayman 2021-02-11 13:41:03 -08:00 committed by GitHub
parent 35468f68e5
commit 763d027dbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 24 deletions

View File

@ -9,7 +9,7 @@
<link rel='icon' type='image/png' href='favicon.png'>
<link rel='stylesheet' href='global.css'>
<link rel='stylesheet' href='build/bundle.css'>
<!-- <link rel='stylesheet' href='build/bundle.css'> -->
<script defer src='build/bundle.js'></script>
</head>

View File

@ -16,13 +16,11 @@ export default {
},
plugins: [
svelte({
// enable run-time checks when not in production
dev: !production,
// we'll extract any component CSS out into
// a separate file - better for performance
css: css => {
css.write('public/build/bundle.css');
}
compilerOptions: {
// enable run-time checks when not in production
dev: !production
},
emitCss: false
}),
// If you have external dependencies installed from
@ -54,18 +52,22 @@ export default {
};
function serve() {
let started = false;
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (!started) {
started = true;
if (server) return;
server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], {
stdio: ['ignore', 'inherit', 'inherit'],
shell: true
});
}
process.on('SIGTERM', toExit);
process.on('exit', toExit);
}
};
}

View File

@ -2374,7 +2374,6 @@ dependencies = [
name = "tauri"
version = "0.11.1"
dependencies = [
"anyhow",
"async-trait",
"base64",
"cfg_aliases",
@ -2398,7 +2397,6 @@ dependencies = [
name = "tauri-api"
version = "0.7.5"
dependencies = [
"anyhow",
"attohttpc",
"clap",
"dirs-next",
@ -2408,7 +2406,6 @@ dependencies = [
"nfd",
"notify-rust",
"once_cell",
"phf",
"rand 0.8.3",
"semver",
"serde",
@ -2451,7 +2448,7 @@ dependencies = [
"serde",
"serde_json",
"syn 1.0.60",
"tauri-api",
"tauri-utils",
"walkdir",
]
@ -2459,7 +2456,10 @@ dependencies = [
name = "tauri-utils"
version = "0.5.1"
dependencies = [
"anyhow",
"flate2",
"phf",
"serde",
"serde_json",
"sysinfo",
"thiserror",
]

View File

@ -47,7 +47,7 @@ fn main() {
// tauri::execute_promise is a helper for APIs that uses the tauri.promisified JS function
// so you can easily communicate between JS and Rust with promises
tauri::execute_promise(
&mut webview,
&mut dispatcher,
async move {
println!("{} {:?}", endpoint, body);
// perform an async operation here

View File

@ -59,8 +59,8 @@
<div class="tabs">
{#each views as view}
<div class="tab">
<input type="radio" checked={view.label===selected} />
<label class="tabber" on:click={()=> select(view)}>{view.label}</label>
<input id={`tab-${view.label}`} type="radio" checked={view.label===selected} />
<label for={`tab-${view.label}`} class="tabber" on:click={()=> select(view)}>{view.label}</label>
<div class="content">
<svelte:component this={view.component} {onMessage} />
</div>