Allows webpack to emit Rectangle object from qml-webpack-loader output. Optionally makes require() for each of Image.source property.
npm i --save-dev qml-images-rectangle-json-loader qml-webpack-loaderwebpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.qml$/,
use: [
{
loader: 'qml-images-rectangle-json-loader',
options: { requireSources: true },
},
'qml-webpack-loader',
],
},
],
},
};qml-webpack-loader-structured output (see json files from qmlweb-parser for examples) with a single Rectangle composed of Image(s)
requireSource: boolean- emitrequire()for eachImage.sourceparsed
import QtQuick 1.1
Rectangle {
width: 4000
height: 5330
Image {
id: background
x: 0
y: 0
width: 4000
height: 5330
source: "Level-1_images/background.png"
opacity: 1
}
Image {
id: cat_black
x: 2161
y: 4252
width: 118
height: 136
source: "Level-1_images/cat_black.png"
opacity: 1
}
}Rectangle object (see definitions).
See also __tests__/cases/successful/%d for input/output examples.