Unexpected token < after angular 2 production build

孤街浪徒 提交于 2019-12-24 03:23:52

问题


After building my angular 2 app with ng build -prod I copied the dist folder 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!

来源:https://stackoverflow.com/questions/43803182/unexpected-token-after-angular-2-production-build

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!