Git Product home page Git Product logo

Comments (40)

kuldeepkeshwar avatar kuldeepkeshwar commented on July 20, 2024 4

@qdouble on running npm run universal:aot and then navigating to localhost:8000 , I am getting below error
although UI renders properly but it is failing on server

Listening on: http://172.16.46.2:8000
EXCEPTION: Cannot read property 'toLowerCase' of undefined
ORIGINAL STACKTRACE:
TypeError: Cannot read property 'toLowerCase' of undefined
    at new StyleCompatibility (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/material/material.umd.js:2250:59)
    at AppView._View_e0.createInternal (e.ngfactory.js:24:34)
    at AppView.create (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:9178:25)
    at AppView._View_e_Host0.createInternal (e_Host.ngfactory.js:17:14)
    at AppView.create (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:9178:25)
    at ComponentFactory.create (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:5832:40)
    at ApplicationRef_.bootstrap (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6804:44)
    at /Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6713:93
    at Array.forEach (native)
    at PlatformRef_._moduleDoBootstrap (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6713:46)
TypeError: Cannot read property 'toLowerCase' of undefined
    at new StyleCompatibility (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/material/material.umd.js:2250:59)
    at AppView._View_e0.createInternal (e.ngfactory.js:24:34)
    at AppView.create (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:9178:25)
    at AppView._View_e_Host0.createInternal (e_Host.ngfactory.js:17:14)
    at AppView.create (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:9178:25)
    at ComponentFactory.create (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:5832:40)
    at ApplicationRef_.bootstrap (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6804:44)
    at /Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6713:93
    at Array.forEach (native)
    at PlatformRef_._moduleDoBootstrap (/Users/kuldeepkeshwar/Desktop/poc/aot/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6713:46)

from angular-webpack-starter.

PatrickJS avatar PatrickJS commented on July 20, 2024 2

this isn't a universal so much as it's a problem with how AoT works, how angular packages their code, and webpack. for externals on the server you need to make sure it bundles any angular code so packages that start with @angular, angular2-, ng2-, ng-, and angular-

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024 2

@fmoessle Universal isn't fully compatible with material unless you roll back to alpha 8, you can track the issue here: angular/components#308

from angular-webpack-starter.

Tuizi avatar Tuizi commented on July 20, 2024 2

@privettoli Angular 4 will be released in few days with a completely new server side rendering. I suggest that you way for this release and migrate to it. Angular Universal will be removed as it will be merged to Angular core

from angular-webpack-starter.

DzmitryShylovich avatar DzmitryShylovich commented on July 20, 2024 1

Material doesn't work with universal

from angular-webpack-starter.

PatrickJS avatar PatrickJS commented on July 20, 2024 1

I added AoT support to universal-starter by making sure every lib on the node side is included to ensure the requires are all correct

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@kodeine is this on clean install or is this with you adding on stuff from your project? Seems to compile fine from my testing.

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

It was on a clean install then adding my components on it. It compiles fine with hmr though.

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

You'd need to test if it works without you adding your components to it. Universal may have issues with certain 3rd party stuff and may not support certain functions/operations... but that is more of an issue to file on the Universal github than things I can take care of here. If it compiles before you add your components, then there's nothing for me to change in the seed.

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

Will close for now, but we can re-open if it crashes with just a clean install and nothing else...otherwise it's a probably a Universal issue that needs to be filed on their repo.

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

@qdouble please reopen this.

fresh install, no changes, here's the log.

user@user:~/Desktop/Projects/SL/another$ npm run server:universal

> [email protected] server:universal /Projects/SL/another
> nodemon dist/server/index.js

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Projects/SL/another/dist/**/*
[nodemon] starting `node dist/server/index.js`
/Projects/SL/another/node_modules/@angular/platform-browser/src/browser/browser_adapter.js:13
import { setRootDomAdapter } from '../dom/dom_adapter';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:528:28)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.23 (/Projects/SL/another/dist/server/index.js:5087:18)
    at __webpack_require__ (/Projects/SL/another/dist/server/index.js:27:30)
[nodemon] app crashed - waiting for file changes before starting...
^C
user@user:~/Desktop/Projects/SL/another$ 

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@kodeine is the initial command you're running npm run universal ? If so, I can't reproduce.

from angular-webpack-starter.

mklemme avatar mklemme commented on July 20, 2024

I'm getting g the same error. Cloned the universal bootstrap branch directly. Mine errors out on npm run compile:universal. I'm trying to deploy the app to Google app engine. Isn't that the command I need to build the prod:universal:aot app?

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@mklemme are you experiencing an issue only with aot or JIT as well? Use npm run universal to create JIT version and npm run universal:aot for AOT version. Can you let me know if you are having issue with each and could you copy and paste the exact error?

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

reopened as I see Universal has some issues in AOT mode... this seems like some issues with Universal itself, which is why the AOT compatible release is in rc, but I will look into if there are any hacks/workarounds until they improve the aot mode compatibility

from angular-webpack-starter.

mklemme avatar mklemme commented on July 20, 2024

@qdouble Here's the error I'm getting:

> [email protected] start /Users/Myk/dev/angular-webpack2-starter
> npm run server:universal


> [email protected] server:universal /Users/Myk/dev/angular-webpack2-starter
> nodemon dist/server/index.js

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/Myk/dev/angular-webpack2-starter/dist/**/*
[nodemon] starting `node dist/server/index.js`
Listening on: http://192.168.1.223:8000
EXCEPTION: Uncaught (in promise): SyntaxError: Unexpected token import
/Users/Myk/dev/angular-webpack2-starter/node_modules/@angular/core/src/linker/ng_module_factory.js:13
import { Injector, THROW_IF_NOT_FOUND } from '../di/injector';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.23 (/Users/Myk/dev/angular-webpack2-starter/dist/server/index.js:2:17435)
    at t (/Users/Myk/dev/angular-webpack2-starter/dist/server/index.js:1:177)
ORIGINAL STACKTRACE:
Error: Uncaught (in promise): SyntaxError: Unexpected token import
/Users/Myk/dev/angular-webpack2-starter/node_modules/@angular/core/src/linker/ng_module_factory.js:13
import { Injector, THROW_IF_NOT_FOUND } from '../di/injector';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.23 (/Users/Myk/dev/angular-webpack2-starter/dist/server/index.js:2:17435)
    at t (/Users/Myk/dev/angular-webpack2-starter/dist/server/index.js:1:177)
    at resolvePromise (/Users/Myk/dev/angular-webpack2-starter/node_modules/zone.js/dist/zone-node.js:468:31)
    at /Users/Myk/dev/angular-webpack2-starter/node_modules/zone.js/dist/zone-node.js:505:17
    at ZoneDelegate.invokeTask (/Users/Myk/dev/angular-webpack2-starter/node_modules/zone.js/dist/zone-node.js:265:35)
    at Object.onInvokeTask (/Users/Myk/dev/angular-webpack2-starter/node_modules/@angular/core/bundles/core.umd.js:6220:41)
    at ZoneDelegate.invokeTask (/Users/Myk/dev/angular-webpack2-starter/node_modules/zone.js/dist/zone-node.js:264:40)
    at Zone.runTask (/Users/Myk/dev/angular-webpack2-starter/node_modules/zone.js/dist/zone-node.js:154:47)
    at drainMicroTaskQueue (/Users/Myk/dev/angular-webpack2-starter/node_modules/zone.js/dist/zone-node.js:401:35)
Unhandled Promise rejection: Unexpected token import ; Zone: angular ; Task: Promise.then ; Value: /Users/Myk/dev/angular-webpack2-starter/node_modules/@angular/core/src/linker/ng_module_factory.js:13
import { Injector, THROW_IF_NOT_FOUND } from '../di/injector';
^^^^^^
SyntaxError: Unexpected token import
    at Object.exports.runInThisContext (vm.js:76:16)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.23 (/Users/Myk/dev/angular-webpack2-starter/dist/server/index.js:2:17435)
    at t (/Users/Myk/dev/angular-webpack2-starter/dist/server/index.js:1:177) /Users/Myk/dev/angular-webpack2-starter/node_modules/@angular/core/src/linker/ng_module_factory.js:13
import { Injector, THROW_IF_NOT_FOUND } from '../di/injector';
^^^^^^

The exception repeats a couple times, but it's the same line and error so I kept it out.

from angular-webpack-starter.

mklemme avatar mklemme commented on July 20, 2024

I was also trying to get the up on app engine by using this as my start command:

"prestart": "npm run compile:universal",
 "start": "npm run server:universal",

Is there an alternative I can use that works currently? Should I use the npm run universal as the prestart command instead?

from angular-webpack-starter.

mklemme avatar mklemme commented on July 20, 2024

confirming npm run universal is working for me.

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@mklemme yes, npm run universal is the command you should use for Universal in JIT mode.

I see the same error as far as Universal in AOT mode, we may have to wait for the next update of Universal for that to be working fine as there appears to be some issue with it not handling deep imports properly when in AOT mode.

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@gdi2290 hey patrick, could you show me an example of how to set that up? I was trying to play with that yesterday, but was getting various crashes.

from angular-webpack-starter.

PatrickJS avatar PatrickJS commented on July 20, 2024

The problem is making webpack2 with target node to understand what's going on since Angular's generated AoT assumes you have a certain build. For angular2 code with es6-modules we need to bundle all of the deep imports made in an AoT generated file that way those imports will work. Normally this is done automatically via webpack looking for the module field in package.json but with target node if you specify externals then the generated code for the module is a require statement. Having files that use es6-modules in node is a problem since it's not supported. My suggestion of bundling any angular namespace also needs to ensure we're bundling the module path rather than main path which is pointing to umd bundle

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

Okay, I will wait until Universal Starter is patched, I was trying to make
changes based on stuff that I saw on the the AOT branch with example on the
Universal repo and what I saw on the Universal Starter repo, but kept
running into this error even when not using AOT mode:
angular/universal-starter#221 (comment)

On Fri, Oct 28, 2016 at 10:45 AM, PatrickJS [email protected]
wrote:

The problem is making webpack2 with target node to understand what's
going on since Angular's generated AoT assumes you have a certain build.
For angular2 code with es6-modules we need to bundle all of the deep
imports made in an AoT generated file that way those imports will work.
Normally this is done automatically via webpack looking for the module
field in package.json but with target node if you specify externals then
the generated code for the module is a require statement. Having files
that use es6-modules in node is a problem since it's not supported. My
suggestion of bundling any angular namespace also needs to ensure we're
bundling the module path rather than main path which is pointing to umd
bundle


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#118 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJ7seNbqqPYRfen9liggxW0Xd3WT7593ks5q4jSygaJpZM4KTITN
.

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

this is what i get when i try universal aot, universal compiles just fine!

$ npm run universal:aot

> [email protected] universal:aot /Projects/SL/another
> npm run compile:universal && npm run server:universal


> [email protected] compile:universal /Projects/SL/another
> npm run sass && npm run clean:compile && npm run ngc:universal && npm run build:universal:aot


> [email protected] sass /Projects/SL/another
> node-sass src -o src --include-path node_modules --output-style compressed -q


> [email protected] clean:compile /Projects/SL/another
> npm run rimraf -- "src/compiled" 


> [email protected] rimraf /Projects/SL/another
> rimraf "src/compiled"


> [email protected] ngc:universal /Projects/SL/another
> ngc -p tsconfig.aot.universal.json

Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol APP_IMPORTS in /Projects/SL/another/src/app/app.imports.ts, resolving symbol AppModule in /Projects/SL/another/src/app/app.module.universal.browser.ts, resolving symbol AppModule in /Projects/SL/another/src/app/app.module.universal.browser.ts
    at simplifyInContext (/Projects/SL/another/node_modules/@angular/compiler-cli/src/static_reflector.js:472:23)
    at StaticReflector.simplify (/Projects/SL/another/node_modules/@angular/compiler-cli/src/static_reflector.js:475:22)
    at StaticReflector.annotations (/Projects/SL/another/node_modules/@angular/compiler-cli/src/static_reflector.js:61:36)
    at _loop_1 (/Projects/SL/another/node_modules/@angular/compiler-cli/src/codegen.js:67:54)
    at CodeGeneratorModuleCollector.readFileMetadata (/Projects/SL/another/node_modules/@angular/compiler-cli/src/codegen.js:80:13)
    at /Projects/SL/another/node_modules/@angular/compiler-cli/src/codegen.js:42:74
    at Array.map (native)
    at CodeGeneratorModuleCollector.getModuleSymbols (/Projects/SL/another/node_modules/@angular/compiler-cli/src/codegen.js:42:35)
    at CodeGenerator.codegen (/Projects/SL/another/node_modules/@angular/compiler-cli/src/codegen.js:121:39)
    at codegen (/Projects/SL/another/node_modules/@angular/compiler-cli/src/main.js:7:81)
Compilation failed

npm ERR! Linux 4.2.0-42-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "ngc:universal"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] ngc:universal: `ngc -p tsconfig.aot.universal.json`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] ngc:universal script 'ngc -p tsconfig.aot.universal.json'.
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 angular-webpack2-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ngc -p tsconfig.aot.universal.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-webpack2-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-webpack2-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Projects/SL/another/npm-debug.log

npm ERR! Linux 4.2.0-42-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "compile:universal"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] compile:universal: `npm run sass && npm run clean:compile && npm run ngc:universal && npm run build:universal:aot`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] compile:universal script 'npm run sass && npm run clean:compile && npm run ngc:universal && npm run build:universal:aot'.
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 angular-webpack2-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run sass && npm run clean:compile && npm run ngc:universal && npm run build:universal:aot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-webpack2-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-webpack2-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Projects/SL/another/npm-debug.log

npm ERR! Linux 4.2.0-42-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "universal:aot"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] universal:aot: `npm run compile:universal && npm run server:universal`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] universal:aot script 'npm run compile:universal && npm run server:universal'.
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 angular-webpack2-starter package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run compile:universal && npm run server:universal
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular-webpack2-starter
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular-webpack2-starter
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Projects/SL/another/npm-debug.log

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

@qdouble any idea on the last error?

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@kodeine AOT support is spotty for Universal even on the official repo...I'm waiting until it stabilizes before trying to patch it

from angular-webpack-starter.

fmoessle avatar fmoessle commented on July 20, 2024

Don't know if this is the same issue:

When using MdDialog, HMR works but with universal:aot or universal I get this error:

[nodemon] 1.11.0 [nodemon] to restart at any time, enterrs [nodemon] watching: /Users/Flo/projects/angular2-webrtc/dist/**/* [nodemon] startingnode dist/server/index.js /Users/Flo/projects/angular2-webrtc/node_modules/@angular/material/dialog/index.js:1 (function (exports, require, module, __filename, __dirname) { export * from './dialog'; ^^^^^^ SyntaxError: Unexpected token export at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:528:28) at Object.Module._extensions..js (module.js:565:10) at Module.load (module.js:473:32) at tryModuleLoad (module.js:432:12) at Function.Module._load (module.js:424:3) at Module.require (module.js:483:17) at require (internal/module.js:20:19) at Object.17 (/Users/Flo/projects/angular2-webrtc/dist/server/index.js:2:29916) at t (/Users/Flo/projects/angular2-webrtc/dist/server/index.js:1:177) [nodemon] app crashed - waiting for file changes before starting...

from angular-webpack-starter.

fmoessle avatar fmoessle commented on July 20, 2024

Do you mean all Material Components?

I am using 8 MD-Components and all of them are working fine with universal and aot, just MdDialog is not working

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@gdi2290 is there anything beyond the webpack config and the bottom functions I need to look out for? When I apply the changes you made to externals and the includeClientPackages, I'm getting this error with JIT haven't attempted AOT yet:

/Users/qdouble/Sites/EXAMPLE_APPS/angular2webpack2-starter/node_modules/ie-shim/index.js:94
;if("document" in self&&!("classList" in document.createElement("_"))){(function(j){"use strict";if(!("Eleme
nt" in j)){return}var a="classList",f="prototype",m=j.Element[f],b=Object,k=String[f].trim||function(){retur
n this.replace(/^\s+|\s+$/g,"")},c=Array[f].indexOf||function(q){var p=0,o=this.length;for(;p<o;p++){if(p in
 this&&this[p]===q){return p}}return -1},n=function(o,p){this.name=o;this.code=DOMException[o];this.message=
p},g=function(p,o){if(o===""){throw new n("SYNTAX_ERR","An invalid or illegal string was specified")}if(/\s/
.test(o)){throw new n("INVALID_CHARACTER_ERR","String contains an invalid character")}return c.call(p,o)},d=
function(s){var r=k.call(s.getAttribute("class")||""),q=r?r.split(/\s+/):[],p=0,o=q.length;for(;p<o;p++){thi
s.push(q[p])}this._updateClassName=function(){s.setAttribute("class",this.toString())}},e=d[f]=[],i=function
(){return new d(this)};n[f]=Error[f];e.item=function(o){return thi

ReferenceError: self is not defined
    at Object.<anonymous> (/Users/qdouble/Sites/EXAMPLE_APPS/angular2webpack2-starter/node_modules/ie-shim/i
ndex.js:94:19)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.19 (/Users/qdouble/Sites/EXAMPLE_APPS/angular2webpack2-starter/dist/server/index.js:47514:18)
    at __webpack_require__ (/Users/qdouble/Sites/EXAMPLE_APPS/angular2webpack2-starter/dist/server/index.js:
21:30)

from angular-webpack-starter.

PatrickJS avatar PatrickJS commented on July 20, 2024

@qdouble do ou have a branch that I can look at?

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@gdi2290 sure, I stripped a lot of the third party and example stuff from this branch so it'll be easier to analyze... you'll see it boots on dev server with npm start, but npm run universal using only a jit build, it stopped working after I updated the externals and includeClientPackages to what you have now on Universal-Starter

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

The branch is https://github.com/qdouble/angular-webpack2-starter/tree/universal-aot-wip by the way, forgot to link it.

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

ionic team has implemented ngc, check their app scripts https://github.com/driftyco/ionic-app-scripts

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

Is this error because AppModule has some non exportable function which i can fix or is it because of AOT issues?

Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol APP_IMPORTS in /Projects/SL/src/app/app.imports.ts, resolving symbol AppModule in /Projects/SL/src/app/app.module.ts, resolving symbol AppModule in /Projects/SL/src/app/app.module.ts
    at simplifyInContext (/Projects/SL/node_modules/@angular/compiler-cli/src/static_reflector.js:472:23)
    at StaticReflector.simplify (/Projects/SL/node_modules/@angular/compiler-cli/src/static_reflector.js:475:22)
    at StaticReflector.annotations (/Projects/SL/node_modules/@angular/compiler-cli/src/static_reflector.js:61:36)
    at _loop_1 (/Projects/SL/node_modules/@angular/compiler-cli/src/codegen.js:67:54)
    at CodeGeneratorModuleCollector.readFileMetadata (/Projects/SL/node_modules/@angular/compiler-cli/src/codegen.js:80:13)
    at /Projects/SL/node_modules/@angular/compiler-cli/src/codegen.js:42:74
    at Array.map (native)
    at CodeGeneratorModuleCollector.getModuleSymbols (/Projects/SL/node_modules/@angular/compiler-cli/src/codegen.js:42:35)
    at CodeGenerator.codegen (/Projects/SL/node_modules/@angular/compiler-cli/src/codegen.js:121:39)
    at codegen (/Projects/SL/node_modules/@angular/compiler-cli/src/main.js:7:81)
Compilation failed

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

from angular-webpack-starter.

Koslun avatar Koslun commented on July 20, 2024

@kodeine As far as I've seen it's a pretty common error when trying to compile with AoT. Where your provider function needs to be exported from somewhere.

from angular-webpack-starter.

kodeine avatar kodeine commented on July 20, 2024

@Koslun @qdouble
is it possible to use some packages as AOT and some not?

from angular-webpack-starter.

qdouble avatar qdouble commented on July 20, 2024

@kodeine it'd have to be compatible not to break AOT, not sure that the package would have to be made with AOT specifically in mind though

from angular-webpack-starter.

Koslun avatar Koslun commented on July 20, 2024

@kodeine @qdouble if it is an angular package where you are importing a @NgModule (which most do, unless it's just the one component or service) it has to be made with AoT in mind. I.e. its build process must export the correct metadata and in the process likely placing them with the same normal AoT constraints mentioned in this project.

More or less all of the dozen or so angular packages I've looked at have struggled with this but believe most of the popular ones have solved it over the past two months or so.

If a particular package has not managed fix AoT but you have a working setup in your project (such as this starter), a quick-fix is to include the entire project into your own build process by dropping it in as a regular code of your project rather than as a dependency.

The better solution of course is to aid them in fixing it, or at least alerting them to the issue and how others have solved it.

from angular-webpack-starter.

fdambrosio avatar fdambrosio commented on July 20, 2024

npm run universal stops with this error:

node_modules/@angular/material/material.umd.js:2028 var hasV8BreakIterator = (window.Intl && window.Intl.v8BreakIterator); ^ ReferenceError: window is not defined at node_modules/@angular/material/material.umd.js:2028:27 node_modules/@angular/material/material.umd.js:2:68) at Object.<anonymous> node_modules/@angular/material/material.umd.js:5:2) at Module._compile (module.js:571:32) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) [nodemon] app crashed - waiting for file changes before starting...

from angular-webpack-starter.

privettoli avatar privettoli commented on July 20, 2024

@qdouble no workaround for this issue yet? I would love to run AOT + universal.

from angular-webpack-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.