Coder Social home page Coder Social logo

Comments (32)

mchambaud avatar mchambaud commented on July 17, 2024 8

How can I do this using angular-cli?!

from cli-universal-demo.

mmathys avatar mmathys commented on July 17, 2024 3

THIS MUST BE FIXED THEN (╯°□°)╯︵ ┻━┻

from cli-universal-demo.

mmathys avatar mmathys commented on July 17, 2024 3

@paulogr I fixed it. I had to whitelist ngx-translate in webpack.config.js so that it also compiles into javascript.

You can do it like this (in webpack.config.js):

externals: [nodeExternals({
  whitelist: [
    /^@angular\/material/,
    /^@ngx-translate\/core/
  ]
})],

Check out this diff on my fork as well

from cli-universal-demo.

mmathys avatar mmathys commented on July 17, 2024

Did I maybe set up es2015 or es5 the wrong way or doesn't it properly compile the node_modules into normal javascript?

from cli-universal-demo.

paulogr avatar paulogr commented on July 17, 2024

I have the same problem here trying to use @ngx-universal/state-transfer

from cli-universal-demo.

mmathys avatar mmathys commented on July 17, 2024

@evertonrobertoauler please help :}

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

@premiumwd Sorry if I misunderstand your question.

The easy answer is no, right now there isn't a way to do this only with the angular-cli.

But it will be possible with a new feature called Schematics, which is under development by the angular-cli team.

https://www.youtube.com/watch?v=jZON4NNNtZY

from cli-universal-demo.

mmathys avatar mmathys commented on July 17, 2024

@premiumwd Why would you want to configure this option angular-cli?

See, in an Angular Universal app you have two sides: the Angular app itself and the server which renders the Angular app. If I remember correctly, I used this option to configure the server which renders Angular.

This option does absolutely nothing to the Angular app, so there is no need to use angular-cli. If you have a look at my file you mentioned in another thread, this wepback option was used to compile the server.

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler I exported using webpack and still have issue.
ngx-translate/core#581

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

when you use webpack, you can not use ts-node, the Unexpected token import comes from ts-node
when you run webpack in prebuild, webpack will generate the file server.js on the dist folder
replace the prebuild and build in your package.json with:

"prestart": "ng build --prod && ngc && webpack",
"start": "node dist/server.js"

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler still same error. Any other ideas?

H:\d>npm run build

> [email protected] prebuild H:\d
> ng build --prod --no-sourcemap && ngc && webpack

Hash: b2206a7f984fc1fd5533
Time: 54650ms
chunk    {0} polyfills.f1fbb5539ef2b7bbd352.bundle.js (polyfills) 160 kB {5} [initial] [rendered]
chunk    {1} main.60aac5f92ce9a8072a06.bundle.js (main) 72.9 kB {4} [initial] [rendered]
chunk    {2} scripts.0aa3d564f58ccf154432.bundle.js (scripts) 127 kB {5} [initial] [rendered]
chunk    {3} styles.0b26c5aa70ec35c51c47.bundle.css (styles) 175 bytes {5} [initial] [rendered]
chunk    {4} vendor.ca225b61e86f922d59fe.bundle.js (vendor) 1.47 MB [initial] [rendered]
chunk    {5} inline.e19e8bf5e70e3ca64a10.bundle.js (inline) 0 bytes [entry] [rendered]
ts-loader: Using [email protected] and H:\d\tsconfig.json
Hash: 883725545653950b7cd6
Version: webpack 3.2.0
Time: 31266ms
    Asset    Size  Chunks             Chunk Names
server.js  178 kB       0  [emitted]  server
   [9] ./src/app/layout/pages/testing/compute/compute.component.ts 1.08 kB {0} [built]
  [14] ./dist/ngfactory/src/app/layout/pages/home/home.component.ngfactory.ts 3.38 kB {0} [built]
  [17] ./src/app/layout/pages/home/home-routing.module.ts 1.27 kB {0} [built]
  [18] ./src/app/layout/pages/404/notfound-routing.module.ts 1.34 kB {0} [built]
  [19] ./src/app/layout/pages/testing/testing-routing.module.ts 1.63 kB {0} [built]
  [20] ./src/app/layout/pages/testing/history/history.module.ts 1.32 kB {0} [built]
  [21] ./src/app/layout/pages/testing/compute/compute.module.ts 1.32 kB {0} [built]
  [22] ./src/app/layout/shared/header/navigation/nav.module.ts 1.45 kB {0} [built]
  [23] ./dist/ngfactory/src/app/layout/pages/testing/testing.component.ngfactory.ts 1.61 kB {0} [built]
  [24] ./dist/ngfactory/src/app/layout/pages/testing/compute/compute.component.ngfactory.ts 1.34 kB {0} [built]
  [25] ./dist/ngfactory/src/app/layout/pages/testing/history/history.component.ngfactory.ts 1.34 kB {0} [built]
  [26] ./dist/ngfactory/src/app/layout/pages/404/404.component.ngfactory.ts 1.55 kB {0} [built]
  [43] ./dist/ngfactory/src/app/app.component.ngfactory.ts 2.43 kB {0} [built]
  [44] ./dist/ngfactory/src/app/app.server.module.ngfactory.ts 10.5 kB {0} [built]
  [52] ./src/server.ts 1.23 kB {0} [built]
    + 71 hidden modules

> [email protected] build H:\d
> node src/server.ts

H:\d\src\server.ts:1
(function (exports, require, module, __filename, __dirname) { import 'reflect-metadata';
                                                              ^^^^^^
SyntaxError: Unexpected token import
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    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.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

run

node dist/server.js

not

src/server.ts

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

webpack transpiles and bundles src/server.ts into dist/server.js

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler got this error now.

H:\d>npm run build

> [email protected] prebuild H:\d
> ng build --prod --no-sourcemap && ngc && webpack

Hash: 232611d627de3ae4ed72
Time: 60949ms
chunk    {0} polyfills.f1fbb5539ef2b7bbd352.bundle.js (polyfills) 160 kB {5} [initial] [rendered]
chunk    {1} main.60aac5f92ce9a8072a06.bundle.js (main) 72.9 kB {4} [initial] [rendered]
chunk    {2} scripts.0aa3d564f58ccf154432.bundle.js (scripts) 127 kB {5} [initial] [rendered]
chunk    {3} styles.0b26c5aa70ec35c51c47.bundle.css (styles) 175 bytes {5} [initial] [rendered]
chunk    {4} vendor.ca225b61e86f922d59fe.bundle.js (vendor) 1.47 MB [initial] [rendered]
chunk    {5} inline.e19e8bf5e70e3ca64a10.bundle.js (inline) 0 bytes [entry] [rendered]
ts-loader: Using [email protected] and H:\d\tsconfig.json
Hash: ffada07615ffe4885e23
Version: webpack 3.2.0
Time: 5407ms
    Asset     Size  Chunks             Chunk Names
server.js  2.68 kB       0  [emitted]  server
   [0] ./src/server.ts 208 bytes {0} [built] [failed] [1 error]

ERROR in ./src/server.ts
Module build failed: A file specified in tsconfig.json could not be found: H:\d\dist\ngfactory\src\app\layout\pages\testing\testing-routing.module.ngfactory.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prebuild: `ng build --prod --no-sourcemap && ngc && webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ChrisR\AppData\Roaming\npm-cache\_logs\2017-07-13T20_05_01_770Z-debug.log

ts.config.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "genDir": "./dist/ngfactory",
    "entryModule": "./src/app/app.module#AppModule"
  }
}

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

Run the following commands, and see if you get the same error, if yes, it could be something about the windows file system, I don't use windows, I have no idea if this demo project works on windows.

git clone https://github.com/evertonrobertoauler/cli-universal-demo
cd cli-universal-demo
npm install
npm run start

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler your project has errors in it.

H:\cli-universal-demo>npm run start

> [email protected] prestart H:\cli-universal-demo
> ng build --prod && gulp before:ngc && ngc && gulp after:ngc && webpack

Hash: 46b508245a1f4e99c577
Time: 5746ms
chunk    {0}  (styles) 28 bytes {3} [initial] [rendered]
chunk    {1} polyfills.b15e503d1c94d651bc63.bundle.js (polyfills) 28 bytes {3} [initial] [rendered]
chunk    {2} main.a1a0db582d2101507798.bundle.js (main) 28 bytes [initial] [rendered]
chunk    {3} inline.1ab8497f74ada8c133cb.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in multi ./src/styles.scss
Module not found: Error: Can't resolve 'sass-loader' in 'H:\cli-universal-demo'
 @ multi ./src/styles.scss

ERROR in Child compilation failed:
Entry module not found: Error: Can't resolve 'sass-loader' in 'H:\cli-universal-demo':
Error: Can't resolve 'sass-loader' in 'H:\cli-universal-demo'

ERROR in multi ./src/polyfills.ts
Module not found: Error: Can't resolve '@ngtools/webpack' in 'H:\cli-universal-demo'
 @ multi ./src/polyfills.ts

ERROR in multi ./src/main.ts
Module not found: Error: Can't resolve '@ngtools/webpack' in 'H:\cli-universal-demo'
 @ multi ./src/main.ts
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prestart: `ng build --prod && gulp before:ngc && ngc && gulp after:ngc && webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prestart script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ChrisR\AppData\Roaming\npm-cache\_logs\2017-07-13T20_47_25_974Z-debug.log

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

I'm not planning on windows support

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

thanks @evertonrobertoauler finally got it running, now i got this error.

H:\d>npm run build

> [email protected] prebuild H:\d
> ng build --prod --no-sourcemap && ngc && webpack

Hash: 8fb2d7e301320195c429
Time: 56974ms
chunk    {0} polyfills.f1fbb5539ef2b7bbd352.bundle.js (polyfills) 160 kB {5} [initial] [rendered]
chunk    {1} main.60aac5f92ce9a8072a06.bundle.js (main) 72.9 kB {4} [initial] [rendered]
chunk    {2} scripts.0aa3d564f58ccf154432.bundle.js (scripts) 127 kB {5} [initial] [rendered]
chunk    {3} styles.0b26c5aa70ec35c51c47.bundle.css (styles) 175 bytes {5} [initial] [rendered]
chunk    {4} vendor.ca225b61e86f922d59fe.bundle.js (vendor) 1.47 MB [initial] [rendered]
chunk    {5} inline.e19e8bf5e70e3ca64a10.bundle.js (inline) 0 bytes [entry] [rendered]
ts-loader: Using [email protected] and H:\d\tsconfig.json
Hash: 883725545653950b7cd6
Version: webpack 3.2.0
Time: 34270ms
    Asset    Size  Chunks             Chunk Names
server.js  178 kB       0  [emitted]  server
   [9] ./src/app/layout/pages/testing/compute/compute.component.ts 1.08 kB {0} [built]
  [14] ./dist/ngfactory/src/app/layout/pages/home/home.component.ngfactory.ts 3.38 kB {0} [built]
  [17] ./src/app/layout/pages/home/home-routing.module.ts 1.27 kB {0} [built]
  [18] ./src/app/layout/pages/404/notfound-routing.module.ts 1.34 kB {0} [built]
  [19] ./src/app/layout/pages/testing/testing-routing.module.ts 1.63 kB {0} [built]
  [20] ./src/app/layout/pages/testing/history/history.module.ts 1.32 kB {0} [built]
  [21] ./src/app/layout/pages/testing/compute/compute.module.ts 1.32 kB {0} [built]
  [22] ./src/app/layout/shared/header/navigation/nav.module.ts 1.45 kB {0} [built]
  [23] ./dist/ngfactory/src/app/layout/pages/testing/testing.component.ngfactory.ts 1.61 kB {0} [built]
  [24] ./dist/ngfactory/src/app/layout/pages/testing/compute/compute.component.ngfactory.ts 1.34 kB {0} [built]
  [25] ./dist/ngfactory/src/app/layout/pages/testing/history/history.component.ngfactory.ts 1.34 kB {0} [built]
  [26] ./dist/ngfactory/src/app/layout/pages/404/404.component.ngfactory.ts 1.55 kB {0} [built]
  [43] ./dist/ngfactory/src/app/app.component.ngfactory.ts 2.43 kB {0} [built]
  [44] ./dist/ngfactory/src/app/app.server.module.ngfactory.ts 10.5 kB {0} [built]
  [52] ./src/server.ts 1.23 kB {0} [built]
    + 71 hidden modules

> [email protected] build H:\d
> node dist/server.js

listening on http://localhost:4000!
ERROR { TypeError: Cannot read property 'match' of undefined
    at new AppComponent (H:\d\dist\server.js:1847:27)
    at createClass (H:\d\node_modules\@angular\core\bundles\core.umd.js:10943:26)
    at createDirectiveInstance (H:\d\node_modules\@angular\core\bundles\core.umd.js:10774:37)
    at createViewNodes (H:\d\node_modules\@angular\core\bundles\core.umd.js:12210:49)
    at createRootView (H:\d\node_modules\@angular\core\bundles\core.umd.js:12105:5)
    at Object.createProdRootView [as createRootView] (H:\d\node_modules\@angular\core\bundles\core.umd.js:12790:12)
    at ComponentFactory_.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:9888:46)
    at ComponentFactoryBoundToModule.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:3365:29)
    at ApplicationRef_.bootstrap (H:\d\node_modules\@angular\core\bundles\core.umd.js:4794:57)
    at H:\d\node_modules\@angular\core\bundles\core.umd.js:4577:81
  __zone_symbol__currentTask:
   ZoneTask {
     _zone:
      Zone {
        _properties: [Object],
        _parent: [Object],
        _name: 'angular',
        _zoneDelegate: [Object] },
     runCount: 0,
     _zoneDelegates: null,
     _state: 'notScheduled',
     type: 'microTask',
     source: 'Promise.then',
     data: undefined,
     scheduleFn: undefined,
     cancelFn: null,
     callback: [Function],
     invoke: [Function] } }
Unhandled Promise rejection: Cannot read property 'match' of undefined ; Zone: <root> ; Task: Promise.then ; Value: { TypeError: Cannot read property 'match' of undefined
    at new AppComponent (H:\d\dist\server.js:1847:27)
    at createClass (H:\d\node_modules\@angular\core\bundles\core.umd.js:10943:26)
    at createDirectiveInstance (H:\d\node_modules\@angular\core\bundles\core.umd.js:10774:37)
    at createViewNodes (H:\d\node_modules\@angular\core\bundles\core.umd.js:12210:49)
    at createRootView (H:\d\node_modules\@angular\core\bundles\core.umd.js:12105:5)
    at Object.createProdRootView [as createRootView] (H:\d\node_modules\@angular\core\bundles\core.umd.js:12790:12)
    at ComponentFactory_.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:9888:46)
    at ComponentFactoryBoundToModule.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:3365:29)
    at ApplicationRef_.bootstrap (H:\d\node_modules\@angular\core\bundles\core.umd.js:4794:57)
    at H:\d\node_modules\@angular\core\bundles\core.umd.js:4577:81
  __zone_symbol__currentTask:
   ZoneTask {
     _zone:
      Zone {
        _properties: {},
        _parent: null,
        _name: '<root>',
        _zoneDelegate: [Object] },
     runCount: 0,
     _zoneDelegates: null,
     _state: 'notScheduled',
     type: 'microTask',
     source: 'Promise.then',
     data: undefined,
     scheduleFn: undefined,
     cancelFn: null,
     callback: [Function],
     invoke: [Function] } } TypeError: Cannot read property 'match' of undefined
    at new AppComponent (H:\d\dist\server.js:1847:27)
    at createClass (H:\d\node_modules\@angular\core\bundles\core.umd.js:10943:26)
    at createDirectiveInstance (H:\d\node_modules\@angular\core\bundles\core.umd.js:10774:37)
    at createViewNodes (H:\d\node_modules\@angular\core\bundles\core.umd.js:12210:49)
    at createRootView (H:\d\node_modules\@angular\core\bundles\core.umd.js:12105:5)
    at Object.createProdRootView [as createRootView] (H:\d\node_modules\@angular\core\bundles\core.umd.js:12790:12)
    at ComponentFactory_.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:9888:46)
    at ComponentFactoryBoundToModule.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:3365:29)
    at ApplicationRef_.bootstrap (H:\d\node_modules\@angular\core\bundles\core.umd.js:4794:57)
    at H:\d\node_modules\@angular\core\bundles\core.umd.js:4577:81
{ Error: Uncaught (in promise): TypeError: Cannot read property 'match' of undefined
TypeError: Cannot read property 'match' of undefined
    at new AppComponent (H:\d\dist\server.js:1847:27)
    at createClass (H:\d\node_modules\@angular\core\bundles\core.umd.js:10943:26)
    at createDirectiveInstance (H:\d\node_modules\@angular\core\bundles\core.umd.js:10774:37)
    at createViewNodes (H:\d\node_modules\@angular\core\bundles\core.umd.js:12210:49)
    at createRootView (H:\d\node_modules\@angular\core\bundles\core.umd.js:12105:5)
    at Object.createProdRootView [as createRootView] (H:\d\node_modules\@angular\core\bundles\core.umd.js:12790:12)
    at ComponentFactory_.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:9888:46)
    at ComponentFactoryBoundToModule.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:3365:29)
    at ApplicationRef_.bootstrap (H:\d\node_modules\@angular\core\bundles\core.umd.js:4794:57)
    at H:\d\node_modules\@angular\core\bundles\core.umd.js:4577:81
    at resolvePromise (H:\d\node_modules\zone.js\dist\zone-node.js:770:31)
    at resolvePromise (H:\d\node_modules\zone.js\dist\zone-node.js:741:17)
    at H:\d\node_modules\zone.js\dist\zone-node.js:818:17
    at ZoneDelegate.invokeTask (H:\d\node_modules\zone.js\dist\zone-node.js:424:31)
    at Zone.runTask (H:\d\node_modules\zone.js\dist\zone-node.js:191:47)
    at drainMicroTaskQueue (H:\d\node_modules\zone.js\dist\zone-node.js:584:35)
    at Server.ZoneTask.invoke (H:\d\node_modules\zone.js\dist\zone-node.js:490:25)
    at emitTwo (events.js:106:13)
    at Server.emit (events.js:191:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:546:12)
  rejection:
   { TypeError: Cannot read property 'match' of undefined
       at new AppComponent (H:\d\dist\server.js:1847:27)
       at createClass (H:\d\node_modules\@angular\core\bundles\core.umd.js:10943:26)
       at createDirectiveInstance (H:\d\node_modules\@angular\core\bundles\core.umd.js:10774:37)
       at createViewNodes (H:\d\node_modules\@angular\core\bundles\core.umd.js:12210:49)
       at createRootView (H:\d\node_modules\@angular\core\bundles\core.umd.js:12105:5)
       at Object.createProdRootView [as createRootView] (H:\d\node_modules\@angular\core\bundles\core.umd.js:12790:12)
       at ComponentFactory_.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:9888:46)
       at ComponentFactoryBoundToModule.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:3365:29)
       at ApplicationRef_.bootstrap (H:\d\node_modules\@angular\core\bundles\core.umd.js:4794:57)
       at H:\d\node_modules\@angular\core\bundles\core.umd.js:4577:81
     __zone_symbol__currentTask:
      ZoneTask {
        _zone: [Object],
        runCount: 0,
        _zoneDelegates: null,
        _state: 'notScheduled',
        type: 'microTask',
        source: 'Promise.then',
        data: undefined,
        scheduleFn: undefined,
        cancelFn: null,
        callback: [Function],
        invoke: [Function] } },
  promise:
   ZoneAwarePromise {
     __zone_symbol__state: 0,
     __zone_symbol__value:
      { TypeError: Cannot read property 'match' of undefined
          at new AppComponent (H:\d\dist\server.js:1847:27)
          at createClass (H:\d\node_modules\@angular\core\bundles\core.umd.js:10943:26)
          at createDirectiveInstance (H:\d\node_modules\@angular\core\bundles\core.umd.js:10774:37)
          at createViewNodes (H:\d\node_modules\@angular\core\bundles\core.umd.js:12210:49)
          at createRootView (H:\d\node_modules\@angular\core\bundles\core.umd.js:12105:5)
          at Object.createProdRootView [as createRootView] (H:\d\node_modules\@angular\core\bundles\core.umd.js:12790:12)
          at ComponentFactory_.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:9888:46)
          at ComponentFactoryBoundToModule.create (H:\d\node_modules\@angular\core\bundles\core.umd.js:3365:29)
          at ApplicationRef_.bootstrap (H:\d\node_modules\@angular\core\bundles\core.umd.js:4794:57)
          at H:\d\node_modules\@angular\core\bundles\core.umd.js:4577:81 __zone_symbol__currentTask: [Object] } },
  zone:
   Zone {
     _properties: {},
     _parent: null,
     _name: '<root>',
     _zoneDelegate:
      ZoneDelegate {
        _taskCounts: [Object],
        zone: [Circular],
        _parentDelegate: null,
        _forkZS: null,
        _forkDlgt: null,
        _forkCurrZone: null,
        _interceptZS: null,
        _interceptDlgt: null,
        _interceptCurrZone: null,
        _invokeZS: null,
        _invokeDlgt: null,
        _invokeCurrZone: null,
        _handleErrorZS: null,
        _handleErrorDlgt: null,
        _handleErrorCurrZone: null,
        _scheduleTaskZS: null,
        _scheduleTaskDlgt: null,
        _scheduleTaskCurrZone: null,
        _invokeTaskZS: null,
        _invokeTaskDlgt: null,
        _invokeTaskCurrZone: null,
        _cancelTaskZS: null,
        _cancelTaskDlgt: null,
        _cancelTaskCurrZone: null,
        _hasTaskZS: null,
        _hasTaskDlgt: null,
        _hasTaskDlgtOwner: null,
        _hasTaskCurrZone: null } },
  task:
   ZoneTask {
     _zone:
      Zone {
        _properties: {},
        _parent: null,
        _name: '<root>',
        _zoneDelegate: [Object] },
     runCount: 0,
     _zoneDelegates: null,
     _state: 'notScheduled',
     type: 'microTask',
     source: 'Promise.then',
     data: undefined,
     scheduleFn: undefined,
     cancelFn: null,
     callback: [Function],
     invoke: [Function] } }

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler heres my repo https://github.com/premiumwd/d

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

please commit and push your files to https://github.com/premiumwd/d

there is no src/server.ts in it

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler updated with latest code. thanks!

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

@premiumwd your welcome

open app.component.ts and replace

translate.use(lang.match(/dt,en,es,fr,it,ja,ko,pt,ru,zhs,zht/) ? lang : 'en' )

with

translate.use(lang && lang.match(/dt,en,es,fr,it,ja,ko,pt,ru,zhs,zht/) ? lang : 'en' )

and everything will work just fine

from cli-universal-demo.

chriseugenerodriguez avatar chriseugenerodriguez commented on July 17, 2024

@evertonrobertoauler really appreciate you helping me on this! Took me weeks on this 💯

from cli-universal-demo.

imraqes avatar imraqes commented on July 17, 2024

I'm still getting this issue ??

from cli-universal-demo.

evertonrobertoauler avatar evertonrobertoauler commented on July 17, 2024

Hi, you can use require('@std/esm') at the beginning of server.ts file:

https://blogs.windows.com/msedgedev/2017/08/10/es-modules-node-today/

from cli-universal-demo.

AnthonyNahas avatar AnthonyNahas commented on July 17, 2024

i fix similar issue with another npm module (@ngrx).
take a look to my solution (only as work around)

ngx-translate/core#581 (comment)

from cli-universal-demo.

imraqes avatar imraqes commented on July 17, 2024

@AnthonyNahas your link is dead

from cli-universal-demo.

mmathys avatar mmathys commented on July 17, 2024

@imraqes @AnthonyNahas this one works: ngx-translate/core#581 (comment)

from cli-universal-demo.

AnthonyNahas avatar AnthonyNahas commented on July 17, 2024

@mmathys thank you

from cli-universal-demo.

rajitgola avatar rajitgola commented on July 17, 2024

@evertonrobertoauler none of these work in windows , doing exactly the same thing with webpack & using the same tsconfig file , it gives an option (Name:) to create a component , and then fails saying
ERROR in ./src/server.ts (5,42): error TS2307: Cannot find module '../dist/ngfactory/src/app/app.server.module.ngfactory'.

from cli-universal-demo.

AnthonyNahas avatar AnthonyNahas commented on July 17, 2024

the js need to be compile for es2015 - commonjs, e.g: via babel
i had a similar problem, and i compiled the js file of the module with babel and it works.
Here is my comment to the solution of the module @ngx-translate/core
or here

from cli-universal-demo.

gg-gg-v1 avatar gg-gg-v1 commented on July 17, 2024

@mmathys I tried using whitelist but still it's not working, could you please help ?
(in webpack.config.js):

externals: [nodeExternals({
whitelist: [
/^@angular/material/,
/^@ngx-translate/core/
]
})],

from cli-universal-demo.

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.