mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
feat(core): make css parsers tree-shakable (#9496)
This commit is contained in:

committed by
Nathan Walker

parent
7960f8361f
commit
dce7408c05
@ -2,6 +2,28 @@ import { defaultConfigs } from '@nativescript/webpack';
|
||||
import { getAllDependencies } from './dependencies';
|
||||
import { error } from './log';
|
||||
|
||||
/**
|
||||
* Utility to determine the project flavor based on installed dependencies
|
||||
* (vue, angular, react, svelete, typescript, javascript...)
|
||||
*/
|
||||
export function projectUsesCustomFlavor(): boolean {
|
||||
const dependencies = getAllDependencies();
|
||||
return [
|
||||
'vue',
|
||||
'angular',
|
||||
'react',
|
||||
'svelte'
|
||||
].includes(determineProjectFlavor())
|
||||
if (dependencies.includes('nativescript-vue') ||
|
||||
dependencies.includes('@nativescript/angular') ||
|
||||
dependencies.includes('react-nativescript') ||
|
||||
dependencies.includes('svelte-native')
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Utility to determine the project flavor based on installed dependencies
|
||||
* (vue, angular, react, svelete, typescript, javascript...)
|
||||
|
@ -9,7 +9,7 @@ import { addVirtualEntry, addVirtualModule } from './virtualModules';
|
||||
import { applyFileReplacements } from './fileReplacements';
|
||||
import { addCopyRule, removeCopyRule } from './copyRules';
|
||||
import { error, info, warn, warnOnce } from './log';
|
||||
import { determineProjectFlavor } from './flavor';
|
||||
import { determineProjectFlavor, projectUsesCustomFlavor } from './flavor';
|
||||
import { getValue } from './config';
|
||||
import { getIPS } from './host';
|
||||
import {
|
||||
@ -47,6 +47,7 @@ export default {
|
||||
},
|
||||
flavor: {
|
||||
determineProjectFlavor,
|
||||
projectUsesCustomFlavor,
|
||||
},
|
||||
host: {
|
||||
getIPS,
|
||||
|
Reference in New Issue
Block a user