chore: working with builder xml require vs dynamic import wip

This commit is contained in:
Nathan Walker
2025-07-22 14:37:11 -07:00
parent b4579d1d2f
commit 0ba0ab0d59
23 changed files with 141 additions and 121 deletions

View File

@@ -526,6 +526,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
__CSS_PARSER__: JSON.stringify(getValue('cssParser', 'css-tree')),
__UI_USE_XML_PARSER__: true,
__UI_USE_EXTERNAL_RENDERER__: false,
__COMMONJS__: !!env.commonjs,
__ANDROID__: platform === 'android',
__IOS__: platform === 'ios',
__VISIONOS__: platform === 'visionos',

View File

@@ -50,6 +50,9 @@ export interface IWebpackEnv {
// print webpack stats (default: true)
stats?: boolean;
// enable commonjs modules (default: ES modules, esm)
commonjs?: boolean;
// misc
replace?: string[] | string;
watchNodeModules?: boolean;
@@ -158,10 +161,9 @@ export function chainWebpack(
* @param mergeFn An object or a function that optionally returns an object (can mutate the object directly and return nothing)
*/
export function mergeWebpack(
mergeFn: ((
config: Partial<webpack.Configuration>,
env: IWebpackEnv,
) => any) | Partial<webpack.Configuration>,
mergeFn:
| ((config: Partial<webpack.Configuration>, env: IWebpackEnv) => any)
| Partial<webpack.Configuration>,
) {
webpackMerges.push(mergeFn);
}

View File

@@ -26,13 +26,13 @@ export default function loader(content: string, map: any) {
const relativePath = relative(
opts.appPath ?? this.rootContext,
this.resourcePath
this.resourcePath,
).replace(/\\/g, '/');
const hmrCode = this.hot
? dedent`
/* NATIVESCRIPT-HOT-LOADER */
if(module.hot && global._isModuleLoadedForUI && global._isModuleLoadedForUI("./${relativePath}")) {
if(module.hot) {
module.hot.accept()
}
`