This repository was archived by the owner on Aug 7, 2021. It is now read-only.
File tree 3 files changed +10
-10
lines changed
3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( "path" ) ;
2
2
const { existsSync } = require ( "fs" ) ;
3
- const { findBootstrapModulePath } = require ( "./utils/ast-utils" ) ;
4
3
const { ANDROID_APP_PATH } = require ( "./androidProjectHelpers" ) ;
5
4
const {
6
5
getPackageJson,
@@ -41,14 +40,6 @@ exports.getEntryModule = function (appDirectory) {
41
40
return entry ;
42
41
} ;
43
42
44
- exports . getMainModulePath = function ( entryFilePath ) {
45
- try {
46
- return findBootstrapModulePath ( entryFilePath ) ;
47
- } catch ( e ) {
48
- return null ;
49
- }
50
- }
51
-
52
43
exports . getAppPath = ( platform , projectDir ) => {
53
44
if ( isIos ( platform ) ) {
54
45
const appName = path . basename ( projectDir ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const nsWebpack = require("nativescript-dev-webpack");
5
5
const nativescriptTarget = require ( "nativescript-dev-webpack/nativescript-target" ) ;
6
6
const { nsReplaceBootstrap } = require ( "nativescript-dev-webpack/transformers/ns-replace-bootstrap" ) ;
7
7
const { nsReplaceLazyLoader } = require ( "nativescript-dev-webpack/transformers/ns-replace-lazy-loader" ) ;
8
+ const { getMainModulePath } = require ( "nativescript-dev-webpack/utils/ast-utils" ) ;
8
9
const CleanWebpackPlugin = require ( "clean-webpack-plugin" ) ;
9
10
const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
10
11
const { BundleAnalyzerPlugin } = require ( "webpack-bundle-analyzer" ) ;
@@ -65,7 +66,7 @@ module.exports = env => {
65
66
// directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes
66
67
// fixes https://github.com/NativeScript/nativescript-cli/issues/4024
67
68
if ( env . externals . indexOf ( "@angular/core" ) > - 1 ) {
68
- const appModuleRelativePath = nsWebpack . getMainModulePath ( resolve ( appFullPath , entryModule ) ) ;
69
+ const appModuleRelativePath = getMainModulePath ( resolve ( appFullPath , entryModule ) ) ;
69
70
if ( appModuleRelativePath ) {
70
71
const appModuleFolderPath = dirname ( resolve ( appFullPath , appModuleRelativePath ) ) ;
71
72
// include the lazy loader inside app module
Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ import * as ts from "typescript";
8
8
import { readFileSync , existsSync } from "fs" ;
9
9
import { collectDeepNodes } from "@ngtools/webpack/src/transformers" ;
10
10
11
+ export function getMainModulePath ( entryFilePath ) {
12
+ try {
13
+ return findBootstrapModulePath ( entryFilePath ) ;
14
+ } catch ( e ) {
15
+ return null ;
16
+ }
17
+ }
18
+
11
19
export function findBootstrapModuleCall ( mainPath : string ) : ts . CallExpression | null {
12
20
if ( ! existsSync ( mainPath ) ) {
13
21
throw new Error ( `Main file (${ mainPath } ) not found` ) ;
You can’t perform that action at this time.
0 commit comments