robwormald / ng-universal-demo

256 stars 125 forks source link

ngfactory not found !! #12

Open kamalkech opened 7 years ago

kamalkech commented 7 years ago

in this demo u can't found ngfactory

esakkik commented 7 years ago

Same issue image

MarkPieszak commented 7 years ago

Use this repo (it has client & server rendering and is up to date): https://github.com/FrozenPandaz/ng-universal-demo @kamalkech @esakkikrishnan

mariohmol commented 7 years ago

@MarkPieszak i tryed to use this repo..it works.. but i'm trying to put mongoose but can t work at all.. and this repo is not able to open issues to discuss.. do you know how to make it compile with mongo? thanks!

MarkPieszak commented 7 years ago

Why wouldn't mongo work it's outside of Angular & SSR itself? What errors are you getting, must be setting up mongo wrong somewhere?

mariohmol commented 7 years ago

What i have is: I'm trying to include this import * as mongoose from 'mongoose';

IN build process:

 WARNING in ./~/mongodb/~/es6-promise/dist/es6-promise.js
    Module not found: Error: Can't resolve 'vertx' in '/Users/mariohmol/projetos/netgas/v2/web/node_modules/
mongodb/node_modules/es6-promise/dist'
     @ ./~/mongodb/~/es6-promise/dist/es6-promise.js 131:20-30

In server process:

"stack": [
    "Error: Cannot find module \".\"",
    "    at new Error (native)",
mariohmol commented 7 years ago

I think i found it.. is need to change the webpack.server.js to have the webpack-node-externals

const { root } = require('./helpers');

const { AotPlugin } = require('@ngtools/webpack');
var nodeExternals = require('webpack-node-externals');

/**
 * This is a server config which should be merged on top of common config
 */
module.exports = {
  entry: root('./src/main.server.ts'),
  output: {
    filename: 'server.js'
  },
  target: 'node',
  externals: [nodeExternals({
      modulesFromFile: true
  })]
};
harshes53 commented 7 years ago

npm install '@angular/animations' -- save

SystemDisc commented 7 years ago

npm i -S @angular/animations fixed it for me. It's an "unmet peer dependency" when running npm install