Closed jibon57 closed 7 years ago
Try to change you routes like this example: `{ path: "home", loadChildren: "./home/home.module#HomeModule" }``
And i think you need a custom loader, take a look at the examples repo on the lazy-load-webpack-aot branch
Thanks for reply @danielgek.
I have added custom loader "ns-module-factory-loader.ts" & changed "appRoutes" as your suggestion but still getting this error:
Running tns prepare...
Executing before-prepare hook from D:\Others\Documents\My_Work\NativeScript\hooks\before-prepare\nativescript-dev-typescript.js
Preparing project...
Project successfully prepared (android)
Running webpack for android...
10% building modules 0/3 modules 3 active ...\My_Work\NativeScript\app\main.aot.ts(node:11916) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with geHash: 08bed44400e0f31028d2
Version: webpack 3.2.0
Time: 6115ms
Asset Size Chunks Chunk Names
assets/icon/course/page8.png 1.73 kB [emitted]
bundle.js 779 bytes 0 [emitted] bundle
vendor.js 3 MB 2 [emitted] [big] vendor
app.css 17.4 kB 1 [emitted] app.css
fonts/fontawesome-webfont.ttf 166 kB [emitted]
fonts/RobotoRegular.ttf 126 kB [emitted]
assets/images/slider-1.jpg 162 kB [emitted]
assets/images/slider-2.jpg 163 kB [emitted]
assets/images/apple.jpg 277 kB [emitted] [big]
assets/images/slider-3.jpg 102 kB [emitted]
assets/icon/book-live-class.png 4.92 kB [emitted]
assets/icon/course-market.png 4.14 kB [emitted]
assets/icon/chat.png 4.07 kB [emitted]
assets/icon/about-icon.png 4.42 kB [emitted]
assets/icon/course/bigbluebuttonbn10.png 4.12 kB [emitted]
assets/icon/course/bigbluebuttonbn.png 4.12 kB [emitted]
assets/icon/course/default.png 2 kB [emitted]
assets/icon/course/dubbing6.png 2.13 kB [emitted]
assets/icon/course/dubbing.png 2.13 kB [emitted]
assets/icon/course/glossary.png 1.55 kB [emitted]
assets/icon/course/forum0.png 1.78 kB [emitted]
assets/icon/course/glossary2.png 1.55 kB [emitted]
assets/icon/course/jibon.png 1.79 kB [emitted]
assets/icon/course/jibon1.png 1.79 kB [emitted]
assets/icon/course/page.png 2.04 kB [emitted]
assets/icon/course/page0.png 1.36 kB [emitted]
assets/icon/course/page7.png 1.14 kB [emitted]
app.css.js 269 bytes 1 [emitted] app.css
assets/icon/course/question.png 1.9 kB [emitted]
assets/icon/course/quiz.png 1.95 kB [emitted]
assets/icon/course/quiz0.png 1.95 kB [emitted]
assets/icon/course/quiz1.png 2.35 kB [emitted]
assets/icon/course/quiz2.png 1.95 kB [emitted]
assets/icon/course/quiz3.png 2.35 kB [emitted]
assets/icon/course/quiz4.png 1.95 kB [emitted]
assets/icon/course/quiz6.png 2.13 kB [emitted]
assets/icon/course/quiz5.png 2.23 kB [emitted]
assets/icon/course/quiz9.png 2 kB [emitted]
assets/icon/course/users.png 3.93 kB [emitted]
assets/icon/course/video.png 2.79 kB [emitted]
assets/icon/flashcards.png 2.65 kB [emitted]
assets/icon/debugging.png 3.19 kB [emitted]
assets/icon/forum.png 5.11 kB [emitted]
assets/icon/go-to-china.png 4.71 kB [emitted]
assets/icon/ic_action_next_item.png 727 bytes [emitted]
assets/icon/ic_action_previous_item.png 744 bytes [emitted]
assets/icon/mic.png 15.8 kB [emitted]
assets/icon/ic_action_remove.png 536 bytes [emitted]
assets/icon/learn-courses.png 3.62 kB [emitted]
assets/icon/microphone.png 18.4 kB [emitted]
assets/images/logo.png 168 kB [emitted]
assets/icon/test.png 5 kB [emitted]
package.json 86 bytes [emitted]
starter.js 39 bytes [emitted]
tns-java-classes.js 0 bytes [emitted]
[110] .. lazy 160 bytes {2} [built]
[160] ./main.aot.ts 363 bytes {0} [built]
[204] ./vendor.ts 484 bytes {2} [built]
[205] ./vendor-platform.android.ts 539 bytes {2} [built]
[256] ./app.css 41 bytes {1} [built]
[259] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB [built]
+ 254 hidden modules
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 19:49 in the original .ts file), resolving symbol appRoutes in D:/Others/Documents/My_Work/NativeScript/app/routing.ts, resolving symbol routing in D:/Others/Documents/My_Work/NativeScript/app/routing.ts, resolving symbol routing in D:/Others/Documents/My_Work/NativeScript/app/routing.ts, resolving symbol AppModule in D:/Others/Documents/My_Work/NativeScript/app/app.module.ts, resolving symbol AppModule in D:/Others/Documents/My_Work/NativeScript/app/app.module.ts
ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
@ ./main.aot.ts 4:29-62
Child extract-text-webpack-plugin D:\Others\Documents\My_Work\NativeScript\node_modules\extract-text-webpack-plugin\dist D:\Others\Documents\My_Work\NativeScript\node_modules\resolve-url-loader\index.js??ref--1-1!D:\Others\Documents\My_Work\NativeScript\node_modules\nativescript-css-loader\index.js??ref--1-2!D:\Others\Documents\My_Work\NativeScript\node_modules\nativescript-dev-webpack\platform-css-loader.js!D:\Others\Documents\My_Work\NativeScript\app\app.css:
[1] ../node_modules/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null,"includeRoot":false}!../node_modules/nativescript-css-loader?{"minimize":false}!../node_modules/nativescript-dev-webpack/platform-css-loader.js!./app.css 950 bytes {0} [built]
[3] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB {0} [built]
+ 2 hidden modules
Webpack Bundle Analyzer saved stats file to D:\Others\Documents\My_Work\NativeScript\report\stats.json
Webpack Bundle Analyzer saved report to D:\Others\Documents\My_Work\NativeScript\report\report.html
child process exited with code 2
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ns-bundle" "--android" "--run-app"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Others\Documents\My_Work\NativeScript\npm-debug.log
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-android-bundle"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ start-android-bundle: `npm run ns-bundle --android --run-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start-android-bundle script 'npm run ns-bundle --android --run-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run ns-bundle --android --run-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Others\Documents\My_Work\NativeScript\npm-debug.log
@jibon57 lock webpack version on you package.json
@danielgek, Will you please explain it little bit more? My package.json part:
"devDependencies": {
"@angular/compiler-cli": "~4.1.2",
"@ngtools/webpack": "~1.5.0",
"babel-traverse": "6.4.5",
"babel-types": "6.4.5",
"babylon": "6.4.5",
"copy-webpack-plugin": "~4.0.1",
"extract-text-webpack-plugin": "~3.0.0",
"lazy": "1.0.11",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-typescript": "^0.4.0",
"nativescript-dev-webpack": "0.7.3",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.1.0",
"typescript": "~2.2.1",
"webpack": "~3.2.0",
"webpack-bundle-analyzer": "^2.8.2",
"webpack-sources": "~1.0.1"
},
@danielgek, I have changed it like this:
"dependencies": {
"acorn": "5.0.0",
"acorn-dynamic-import": "2.0.0",
"ajv": "5.1.5",
"ajv-keywords": "2.0.0",
"async": "2.1.2",
"enhanced-resolve": "3.3.0",
"escope": "3.6.0",
"interpret": "1.0.0",
"json-loader": "0.5.4",
"json5": "0.5.1",
"loader-runner": "2.3.0",
"loader-utils": "1.1.0",
"memory-fs": "~0.4.1",
"mkdirp": "0.5.0",
"node-libs-browser": "2.0.0",
"source-map": "0.5.3",
"supports-color": "3.1.0",
"tapable": "0.2.5",
"uglifyjs-webpack-plugin": "0.4.6",
"watchpack": "1.3.1",
"webpack-sources": "1.0.1",
"yargs": "6.0.0"
},
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"devDependencies": {
"beautify-lint": "1.0.3",
"benchmark": "2.1.1",
"bundle-loader": "0.5.0",
"codacy-coverage": "2.0.1",
"codecov.io": "0.1.2",
"coffee-loader": "0.7.1",
"coffee-script": "1.10.0",
"coveralls": "2.11.2",
"css-loader": "0.28.3",
"es6-promise-polyfill": "1.1.1",
"eslint": "3.12.2",
"eslint-plugin-node": "3.0.5",
"express": "4.13.1",
"extract-text-webpack-plugin": "3.0.0",
"file-loader": "0.11.1",
"i18n-webpack-plugin": "0.3.0",
"istanbul": "0.4.5",
"jade": "1.11.0",
"jade-loader": "0.8.0",
"js-beautify": "1.5.10",
"less": "2.5.1",
"less-loader": "4.0.3",
"lodash": "4.17.4",
"mocha": "3.2.0",
"mocha-lcov-reporter": "1.0.0",
"nsp": "2.6.1",
"raw-loader": "0.5.0",
"react": "15.2.1",
"react-dom": "15.2.1",
"script-loader": "0.7.0",
"should": "11.1.1",
"simple-git": "1.65.0",
"sinon": "2.3.2",
"style-loader": "0.18.1",
"url-loader": "0.5.0",
"val-loader": "1.0.2",
"vm-browserify": "0.0.0",
"webpack-dev-middleware": "1.9.0",
"worker-loader": "0.8.0"
},
But still same error :( :
Running webpack for android...
10% building modules 0/3 modules 3 active ...\My_Work\NativeScript\app\main.aot.ts(node:2892) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with geHash: 27e399cd908a64dd257b
Version: webpack 3.2.0
Time: 7109ms
Asset Size Chunks Chunk Names
assets/icon/course/page8.png 1.73 kB [emitted]
bundle.js 779 bytes 0 [emitted] bundle
vendor.js 3 MB 2 [emitted] [big] vendor
app.css 17.4 kB 1 [emitted] app.css
fonts/fontawesome-webfont.ttf 166 kB [emitted]
fonts/RobotoRegular.ttf 126 kB [emitted]
assets/images/apple.jpg 277 kB [emitted] [big]
assets/images/slider-1.jpg 162 kB [emitted]
assets/images/slider-2.jpg 163 kB [emitted]
assets/images/slider-3.jpg 102 kB [emitted]
assets/icon/about-icon.png 4.42 kB [emitted]
assets/icon/book-live-class.png 4.92 kB [emitted]
assets/icon/chat.png 4.07 kB [emitted]
assets/icon/course-market.png 4.14 kB [emitted]
assets/icon/course/bigbluebuttonbn.png 4.12 kB [emitted]
assets/icon/course/default.png 2 kB [emitted]
assets/icon/course/bigbluebuttonbn10.png 4.12 kB [emitted]
assets/icon/course/dubbing.png 2.13 kB [emitted]
assets/icon/course/dubbing6.png 2.13 kB [emitted]
assets/icon/course/forum0.png 1.78 kB [emitted]
assets/icon/course/glossary.png 1.55 kB [emitted]
assets/icon/course/glossary2.png 1.55 kB [emitted]
assets/icon/course/jibon.png 1.79 kB [emitted]
assets/icon/course/jibon1.png 1.79 kB [emitted]
assets/icon/course/page.png 2.04 kB [emitted]
assets/icon/course/page0.png 1.36 kB [emitted]
assets/icon/course/page7.png 1.14 kB [emitted]
app.css.js 269 bytes 1 [emitted] app.css
assets/icon/course/question.png 1.9 kB [emitted]
assets/icon/course/quiz.png 1.95 kB [emitted]
assets/icon/course/quiz0.png 1.95 kB [emitted]
assets/icon/course/quiz1.png 2.35 kB [emitted]
assets/icon/course/quiz2.png 1.95 kB [emitted]
assets/icon/course/quiz3.png 2.35 kB [emitted]
assets/icon/course/quiz4.png 1.95 kB [emitted]
assets/icon/course/quiz5.png 2.23 kB [emitted]
assets/icon/course/quiz6.png 2.13 kB [emitted]
assets/icon/course/quiz9.png 2 kB [emitted]
assets/icon/course/video.png 2.79 kB [emitted]
assets/icon/course/users.png 3.93 kB [emitted]
assets/icon/debugging.png 3.19 kB [emitted]
assets/icon/flashcards.png 2.65 kB [emitted]
assets/icon/forum.png 5.11 kB [emitted]
assets/icon/go-to-china.png 4.71 kB [emitted]
assets/icon/ic_action_next_item.png 727 bytes [emitted]
assets/icon/ic_action_previous_item.png 744 bytes [emitted]
assets/icon/ic_action_remove.png 536 bytes [emitted]
assets/icon/learn-courses.png 3.62 kB [emitted]
assets/icon/mic.png 15.8 kB [emitted]
assets/icon/microphone.png 18.4 kB [emitted]
assets/images/logo.png 168 kB [emitted]
assets/icon/test.png 5 kB [emitted]
package.json 86 bytes [emitted]
starter.js 39 bytes [emitted]
tns-java-classes.js 0 bytes [emitted]
[110] .. lazy 160 bytes {2} [built]
[160] ./main.aot.ts 363 bytes {0} [built]
[204] ./vendor.ts 484 bytes {2} [built]
[205] ./vendor-platform.android.ts 539 bytes {2} [built]
[256] ./app.css 41 bytes {1} [built]
[259] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB [built]
+ 254 hidden modules
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 19:49 in the original .ts file), resolving symbol appRoutes in D:/Others/Documents/My_Work/NativeScript/app/routing.ts, resolving symbol routing in D:/Others/Documents/My_Work/NativeScript/app/routing.ts, resolving symbol routing in D:/Others/Documents/My_Work/NativeScript/app/routing.ts, resolving symbol AppModule in D:/Others/Documents/My_Work/NativeScript/app/app.module.ts, resolving symbol AppModule in D:/Others/Documents/My_Work/NativeScript/app/app.module.ts
ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
@ ./main.aot.ts 4:29-62
Child extract-text-webpack-plugin D:\Others\Documents\My_Work\NativeScript\node_modules\extract-text-webpack-plugin\dist D:\Others\Documents\My_Work\NativeScript\node_modules\resolve-url-loader\index.js??ref--1-1!D:\Others\Documents\My_Work\NativeScript\node_modules\nativescript-css-loader\index.js??ref--1-2!D:\Others\Documents\My_Work\NativeScript\node_modules\nativescript-dev-webpack\platform-css-loader.js!D:\Others\Documents\My_Work\NativeScript\app\app.css:
[1] ../node_modules/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null,"includeRoot":false}!../node_modules/nativescript-css-loader?{"minimize":false}!../node_modules/nativescript-dev-webpack/platform-css-loader.js!./app.css 950 bytes {0} [built]
[3] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB {0} [built]
+ 2 hidden modules
Webpack Bundle Analyzer saved stats file to D:\Others\Documents\My_Work\NativeScript\report\stats.json
Webpack Bundle Analyzer saved report to D:\Others\Documents\My_Work\NativeScript\report\report.html
child process exited with code 2
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ns-bundle" "--android" "--build-app"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\Others\Documents\My_Work\NativeScript\npm-debug.log
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build-android-bundle"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ build-android-bundle: `npm run ns-bundle --android --build-app`
npm ERR! Exit status 1
Same issue here
Hi,
I am trying to use webpack in my existing project but I am getting following error:
In where I am doing wrong?
app.modules.ts:
routing.ts