Skip to content

Universal Rendering - ReferenceError: webpackJsonp is not defined #7534

@iUwej

Description

@iUwej

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.6
node: 7.0.0
os: darwin x64
@angular/animations: 4.3.6
@angular/common: 4.3.5
@angular/compiler: 4.3.5
@angular/core: 4.3.5
@angular/forms: 4.3.5
@angular/http: 4.3.5
@angular/platform-browser: 4.3.5
@angular/platform-browser-dynamic: 4.3.5
@angular/router: 4.3.5
@angular/cli: 1.0.6
@angular/compiler-cli: 4.3.5

Repro steps.

I built server side rendering support as in the story https://github.com/angular/angular-cli/wiki/stories-universal-rendering

I have a file server.js with the code

// Load zone.js for the server.
require('zone.js/dist/zone-node');

// Import renderModuleFactory from @angular/platform-server.
var renderModuleFactory = require('@angular/platform-server').renderModuleFactory;

// Import the AOT compiled factory for your AppServerModule.
// This import will change with the hash of your built server bundle.
var AppServerModuleNgFactory = require('./dist-server/main.bundle').AppServerModuleNgFactory;

// Load the index.html file.
var index = require('fs').readFileSync('./src/index.html', 'utf8');

// Render to HTML and log it to the console.
renderModuleFactory(AppServerModuleNgFactory, {document: index, url: '/'}).then(html => console.log(html));

invoke node server.js

The log given by the failure.

ReferenceError: webpackJsonp is not defined
    at Object.<anonymous> (/Users/suiluj/projects/design-portal-frontend/dist-server/main.bundle.js:1:63)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/suiluj/projects/design-portal-frontend/server.js:9:32)
    at Module._compile (module.js:573:32)

Desired functionality.

Should print out the content on index.html

Mention any other details that might be useful.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions