forked from slint-ui/slint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
25 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
// Copyright © SixtyFPS GmbH <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial | ||
|
||
// TODO: Do build and package wasm-lsp separately. Right now vite does not | ||
// support `exclude` in web workers! | ||
|
||
import { defineConfig } from "vite"; | ||
|
||
export default defineConfig(({ command, _mode }) => { | ||
|
@@ -14,12 +17,16 @@ export default defineConfig(({ command, _mode }) => { | |
base: "./", | ||
}; | ||
|
||
let global_aliases = { | ||
"@lsp/": "../../../lsp/pkg/", | ||
}; | ||
|
||
if (command === "serve") { | ||
// For development builds, serve the wasm interpreter straight out of the local file system. | ||
base_config.resolve = { | ||
alias: { | ||
"@preview/": "../../../api/wasm-interpreter/pkg/", | ||
"@lsp/": "../../../lsp/pkg/", | ||
...global_aliases, | ||
}, | ||
}; | ||
} else { | ||
|
@@ -28,13 +35,13 @@ export default defineConfig(({ command, _mode }) => { | |
// relative path to the interpreter is as below. | ||
base_config.build = {}; | ||
base_config.build.rollupOptions = { | ||
external: [new RegExp("/wasm-[a-z]+/slint")], | ||
external: ["../../../../wasm-interpreter/slint_wasm_interpreter.js"], | ||
input: ["index.html", "preview.html"], | ||
}; | ||
base_config.resolve = { | ||
alias: { | ||
"@preview/": "../../../../wasm-interpreter/", | ||
"@lsp/": "../../../../wasm-lsp/", | ||
...global_aliases, | ||
}, | ||
}; | ||
} | ||
|