Import of module in Javascript does not respect qmldir->prefer
-
In my root.qml file I import a QML module A that includes a Javascript resource
a.js
. In this javascript resource, I import a second QML module B that also includes a Javascript resourceb.js
. Froma.js
I then call a function fromb.js
. The unfortunate thing is that when modifyingb.js
and restarting the application, the changes are not loaded. I have to rebuild the whole application first.I have setup my application with two configurations, release and debug. When in debug, I load the .qml files from local disk instead of the Qt resource system to enable developers to quickly iterate on styling drafts without having to rebuild the application everytime.
This is done by loading the root.qml file in my C++ main.cpp already from a local file path. And in addition every module includes the line
prefer ./path/to/module
to make the modules also load from disk.This setup works almost everywhere, except in the case described above. Somehow the
.import
directive does not respect theprefer
line of the QML module when importing, causing it to load it from, I guess, the Qt resource system?
When importing the same module B from a QML file, the loading from disk works flawlessly.
So my only problem is really when a Javascript file imports a module.Does somebody know, how I could fix or workaround this issue? I am using CMake to build my application.