mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-28 21:45:00 +03:00
fix(core): do not embed assets on dev when using a URL (#8739)
This commit is contained in:
parent
cb613beea6
commit
0a01b5b720
@ -157,30 +157,34 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
|
||||
options = options.with_csp();
|
||||
}
|
||||
|
||||
let assets = match &config.build.frontend_dist {
|
||||
Some(url) => match url {
|
||||
FrontendDist::Url(_url) => Default::default(),
|
||||
FrontendDist::Dist(path) => {
|
||||
let assets_path = config_parent.join(path);
|
||||
if !assets_path.exists() {
|
||||
panic!(
|
||||
"The `frontendDist` configuration is set to `{:?}` but this path doesn't exist",
|
||||
path
|
||||
)
|
||||
let assets = if dev && config.build.dev_url.is_some() {
|
||||
Default::default()
|
||||
} else {
|
||||
match &config.build.frontend_dist {
|
||||
Some(url) => match url {
|
||||
FrontendDist::Url(_url) => Default::default(),
|
||||
FrontendDist::Dist(path) => {
|
||||
let assets_path = config_parent.join(path);
|
||||
if !assets_path.exists() {
|
||||
panic!(
|
||||
"The `frontendDist` configuration is set to `{:?}` but this path doesn't exist",
|
||||
path
|
||||
)
|
||||
}
|
||||
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options, target))?
|
||||
}
|
||||
EmbeddedAssets::new(assets_path, &options, map_core_assets(&options, target))?
|
||||
}
|
||||
FrontendDist::Files(files) => EmbeddedAssets::new(
|
||||
files
|
||||
.iter()
|
||||
.map(|p| config_parent.join(p))
|
||||
.collect::<Vec<_>>(),
|
||||
&options,
|
||||
map_core_assets(&options, target),
|
||||
)?,
|
||||
_ => unimplemented!(),
|
||||
},
|
||||
None => Default::default(),
|
||||
FrontendDist::Files(files) => EmbeddedAssets::new(
|
||||
files
|
||||
.iter()
|
||||
.map(|p| config_parent.join(p))
|
||||
.collect::<Vec<_>>(),
|
||||
&options,
|
||||
map_core_assets(&options, target),
|
||||
)?,
|
||||
_ => unimplemented!(),
|
||||
},
|
||||
None => Default::default(),
|
||||
}
|
||||
};
|
||||
|
||||
let out_dir = {
|
||||
|
1
examples/api/dist/assets/index.css
vendored
1
examples/api/dist/assets/index.css
vendored
File diff suppressed because one or more lines are too long
43
examples/api/dist/assets/index.js
vendored
43
examples/api/dist/assets/index.js
vendored
File diff suppressed because one or more lines are too long
15
examples/api/dist/index.html
vendored
15
examples/api/dist/index.html
vendored
@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>API Example App</title>
|
||||
<script type="module" crossorigin src="/assets/index.js"></script>
|
||||
<link rel="stylesheet" href="/assets/index.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
BIN
examples/api/dist/tauri_logo.png
vendored
BIN
examples/api/dist/tauri_logo.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 2.7 KiB |
Loading…
Reference in New Issue
Block a user