Optimize wasm bindgen asset with manganis (#3531)
This commit is contained in:
1 parent
d8850c7666
commit
13dcd80fbf
29 files changed
+933
-1089
No files matched your search
@@ -0,0 +1,34 @@
|
||||
// This test checks the CLI optimizes assets correctly without breaking them
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
const MONACO_FOLDER: Asset = asset!("/monaco-editor-0.52.2/package/min/vs");
|
||||
|
||||
fn main() {
|
||||
dioxus::launch(App);
|
||||
}
|
||||
|
||||
#[component]
|
||||
fn App() -> Element {
|
||||
let script = format!("(() => {{
|
||||
require.config({{ paths: {{ vs: '{MONACO_FOLDER}' }} }});
|
||||
|
||||
require(['vs/editor/editor.main'], () => {{
|
||||
var model = monaco.editor.createModel('fn main() {{\\n\\tprintln!(\\\"hi\\\")\\n}}', 'rust');
|
||||
var editor = monaco.editor.create(document.getElementById('editor'));
|
||||
editor.setModel(model);
|
||||
}})
|
||||
}})()");
|
||||
rsx! {
|
||||
div {
|
||||
id: "editor",
|
||||
width: "100vw",
|
||||
height: "100vw",
|
||||
}
|
||||
// Monaco script
|
||||
script {
|
||||
src: "{MONACO_FOLDER}/loader.js",
|
||||
"onload": script
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user