@nativescript-community/xml-ui-loader
A webpack loader that works as an ahead-of-time (AOT) compiler which turns XML content into JavaScript during the build phase.
npm i --save @nativescript-community/xml-ui-loader
- Version: 3.3.1-alpha.3
- GitHub:
- NPM: https://www.npmjs.com/package/%40nativescript-community%2Fxml-ui-loader
- Downloads:
- Last Day: 0
- Last Week: 40
- Last Month: 121
@nativescript-community/xml-ui-loader
This loader provides support for using @nativescript-community/xml-ui-compiler in Webpack.
Installation
npm install @nativescript-community/xml-ui-loader --save-dev
Usage
webpack.config.js
const webpack = require('@nativescript/webpack');
const { getEntryDirPath, getPlatformName } = require('@nativescript/webpack/dist/helpers/platform');
const { chainLoaderConfiguration } = require("@nativescript-community/xml-ui-loader/helpers");
module.exports = (env) => {
webpack.init(env);
// Learn how to customize:
// https://docs.nativescript.org/webpack
webpack.chainWebpack((config) => {
chainLoaderConfiguration(config, {
appPath: getEntryDirPath(),
platform: getPlatformName()
});
});
return webpack.resolveConfig();
};
There are also few preprocessing options that are useful for applying output customizations.
chainLoaderConfiguration(config, {
appPath: getEntryDirPath(),
platform: getPlatformName(),
useDataBinding: false, // Set this to false if you don't want to use data binding system
preprocess: {
// Format attribute value
attributeValueFormatter: (value, attributeName, tagName, attributes) => value.toUpperCase(),
// Manage AST result
transformAst: (ast, generateFunc) => generateFunc(ast).code,
}
});