Friday 5 May 2017

Unexpected token < after angular 2 production build

After building my angular 2 app with ng build -prod I copied the dist folder to in my node.js project and modified the base tag to <base href="/app/">

Now when I try open in the browser I receive following errors:

polyfills.aa13f03….bundle.js:1 Uncaught SyntaxError: Unexpected token < vendor.3dc323c….bundle.js:1 Uncaught SyntaxError: Unexpected token < main.ba0828d….bundle.js:1 Uncaught SyntaxError: Unexpected token <

the node.js route:

router.route('/app/*').get(function (req, res) {
    res.sendFile('app/index.html', {root: __dirname })
});

Angular Version: 5.1.0 Angular Cli Version: 1.0.1

Thanks!



via miholzi

No comments:

Post a Comment