I want to load an external JavaScript file index.js in index.html within QWebEngineView.
qrc file:
<RCC>
<qresource prefix="/">
<file>index.html</file>
<file>index.js</file>
</qresource>
</RCC>
index.js and index.html file:
console.log('test');
<!DOCTYPE html>
<html lang="en">
<body>
<h1>Hello world!</h1>
<script src="index.js"></script>
</body>
</html>
I use ui->widget->load(QUrl("qrc:/index.html")); to load the html file, and run in debug mode. It works fine, I can see "Hello world!" and console message "test". When I run in release mode, I got a Resource :/index.js not found or is empty.
I can see some difference files in release build folder, like index_js.cpp which not generated in debug mode, it seems that qml engine load the js file. How to disable it and load js file in release mode properly?
My Qt Version: 5.12.7 MSVC2017 64bit.