mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00

* feat(bundle): support for file qualifiers in builder * chore: add qualifiers test app * chore: add @Deprecated for file-name-resolver * fix(hmr): hmr not working for scss files * chore: globals clean-up * shore: fix tslint * tests: uncomment test fixed by ns-dev-webpack * chore: move qualifiers app to e2e * chore: update webpack config * chore: tslint errors * test: fix wrong css import
18 lines
522 B
TypeScript
18 lines
522 B
TypeScript
export function sanitizeModuleName(moduleName: string, removeExtension: boolean = true): string {
|
|
moduleName = moduleName.trim();
|
|
|
|
if (moduleName.startsWith("~/")) {
|
|
moduleName = moduleName.substring(2);
|
|
} else if (moduleName.startsWith("/")) {
|
|
moduleName = moduleName.substring(1);
|
|
}
|
|
|
|
if (removeExtension) {
|
|
const lastDot = moduleName.lastIndexOf(".");
|
|
if (lastDot > 0) {
|
|
moduleName = moduleName.substr(0, lastDot);
|
|
}
|
|
}
|
|
|
|
return moduleName;
|
|
} |