Angular2与Webpack

时间:2016-09-02 06:39:33

标签: angular webpack

我正在尝试按照此处列出的步骤:https://angular.io/docs/ts/latest/guide/webpack.html但似乎无法让基本的hello世界发挥作用。我的项目似乎成功构建,但当我将浏览器指向http://localhost:8080/时,我在上次请求时看到此错误(404):

  

16.09.02 00:35:06 200 GET /index.html

     

16.09.02 00:35:06 200 GET /app.63d880f68c1209ba2e74.css

     

16.09.02 00:35:06 200 GET /app.63d880f68c1209ba2e74.js

     

16.09.02 00:35:08 200 GET /polyfills.63d880f68c1209ba2e74.js

     

16.09.02 00:35:30 200 GET /app.63d880f68c1209ba2e74.css.map

     

16.09.02 00:35:31 200 GET /polyfills.63d880f68c1209ba2e74.js.map

     

16.09.02 00:35:31 200 GET /vendor.63d880f68c1209ba2e74.js

     

16.09.02 00:35:33 404 GET / <main>     <h1>Hello from Angular 2 App with Webpack</h1>     <img src="/assets/angular.9db278d630f5fabd8e7ba16c2e329a3a.png">   </main>

在控制台中,我得到以下内容:

  

rozone.js:101获取http://localhost:8080/%3Cmain%3E%0A%20%20%3Ch1%3EHello%20from%20Angular%202 ... assets / angular.9db278d630f5fabd8e7ba16c2e329a3a.png%22%3E%0A%3C / main%3E%0A 404(未找到)scheduleTask @ zone.js:101ZoneDelegate.scheduleTask @ zone.js:345Zone.scheduleMacroTask @ zone.js:282(匿名函数)@ zone.js:122send @ VM62:3ResourceLoaderImpl.get @ platform-b​​rowser-dynamic.umd.js:131DirectiveNormalizer._fetch @ compiler.umd.js :13450DirectiveNormalizer.normalizeTemplateAsync @ compiler.umd.js:13493DirectiveNormalizer.normalizeDirective @ compiler.umd.js:13468RuntimeCompiler._createCompiledTemplate @ compiler.umd.js:16843(匿名函数)@ compiler.umd.js:16781(匿名函数)@编译器.umd.js:16779RuntimeCompiler._compileComponents @ compiler.umd.js:16778RuntimeCompiler。 compileModuleAndComponents @ compiler.umd.js:16715RuntimeCompiler.compileModuleAsync @ compiler.umd.js:16706PlatformRef bootstrapModuleWithZone @ core .umd.js:9488PlatformRef .bootstrapModule @ core.umd.js:9470webpackJsonp.0 @main.ts:9__webpack_require_ _ @ bootstrap 63d880f ...:50webpackJsonpCallback @ bootstrap 63d880f ...:21(匿名函数)@ app.63d880f ... .js:1   zone.js:484未处理的承诺拒绝:无法加载%3Cmain%3E%0A%20%20%3Ch1%3EHello%20from%20Angular%202%20App%20with%20Webpack%3C / h1%3E%0A%20%20 %3Cimg%20src =%22 / assets / angular.9db278d630f5fabd8e7ba16c2e329a3a.png%22%3E%0A%3C / main%3E%0A;区域:;任务:Promise.then;值:无法加载%3Cmain%3E%0A%20%20%3Ch1%3EHello%20from%20Angular%202%20App%20with%20Webpack%3C / h1%3E%0A%20%20%3Cimg%20src =%22 /assets/angular.9db278d630f5fabd8e7ba16c2e329a3a.png%22%3E%0A%3C/main%3E%0A undefinedconsoleError @ zone.js:484_loop_1 @ zone.js:511drainMicroTaskQueue @ zone.js:515ZoneTask.invoke @ zone.js:437   zone.js:486错误:未捕获(承诺):无法加载%3Cmain%3E%0A%20%20%3Ch1%3EHello%20from%20Angular%202%20App%20with%20Webpack%3C / h1%3E%0A %20%20%3Cimg%20src =%22 / assets / angular.9db278d630f5fabd8e7ba16c2e329a3a.png%22%3E%0A%3C / main%3E%0A(...)consoleError @ zone.js:486_loop_1 @ zone.js:511drainMicroTaskQueue @ zone.js:515ZoneTask.invoke @ zone.js:437   :8080 / favicon.ico:1获取http://localhost:8080/favicon.ico 404(未找到)

任何帮助都将非常感谢...如果你能够通过遵循指南来实现这一点,那也可能有用,因为它可能意味着我某种程度上未能输入我应该在哪里...任何线索都会很棒,因为我不知道这里发生了什么...... :(

0 个答案:

没有答案