qt_add_qml_module code works for desktop but not for wasm
-
Create main UI module
qt_add_qml_module(UiLib
URI "UI"
VERSION 1.0
OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/qml_modules/UI
QML_FILES
qml/Main.qml
qml/login/LoginWindow.qml
qml/login/LoginView.qml
qml/login/RegisterView.qml
qml/login/ForgotPasswordView.qml
qml/login/EmailVerificationView.qml
qml/login/LoginGlowOrbs.qml
qml/login/LoginBorderOrbs.qml
IMPORTS
QtQuick
QtQuick.Controls
QtQuick.Dialogs
QtQuick.Layouts
QtMultimedia
)loadFromModule("UI", "Main")
the loadFromModule works for my desktop build but not in the browser for some reason
the files are reachable through their qrc:/ path (qrc:/qt/qml/qml/Main.qml, etc) but not as modules.
dealing with these qrc paths is just too great of an hassle, importing, lsp and linting into code make me feel like I am doing surgery in mud with a kitchen knife and toothpicks
-
Hi,
please format your code, using the </> code formatting tags. It makes just so much easier to read.
WASM is a bit stricter than other OSes when it comes to deployment and embedded resources.
Most certainly addingRESOURCE_PREFIX /qt/qmlright above the imports will solve the problem.