Closed mariohmol closed 7 years ago
@MarkPieszak could you make your router to work?
Made from the scratch following this https://github.com/FrozenPandaz/ng-universal-demo and worked.
Had some issues with transfer state and material, but seems to be going to have on next version of universal 4.1
thanks
Actually.. i found the error. it happen when i change the webpack.server.js
to have externals: [nodeExternals({ modulesFromFile: true })]
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
})]
};
But i need this to make mongoose to work. If i remove this from webpack, and i try to do a mongoose.connect(DATABASE_URL, err => {
i will receive this error
Error: Cannot find module "."
at new Error (native)
at webpackMissingModule (/Users/mariohmol/projetos/netgas/v2/web/dist/server.js:215729:56) [<root>]
Found that.. to work use
externals: [nodeExternals({
modulesFromFile: true,
modulesDir: './node_modules'
})]
Hi there!
Awesome example!
I'm trying to reproduce this but i cant make the routes to work, just the first route works ,I tryed using Component and the Modul, but boths gives me the same error:
Example of paths:
When I call a link with
routerLink="/home/client" routerLinkActive="active"
this works, changing the url to be /home/seller , but if i use the path directly (http://localhost/home/seller
) it gives me this errorAny ideas?
Other thing is , what is the needed of server.aot , has this been call/used anywhere?
The full stack error