为什么它在控制台中显示如下。
我试图像this 那样做ERROR in Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
at Object.resolveEntryModuleFromMain (D:\Users\cli-quickstart\cli-quickstart\node_modules\@ngtools\webpack\src\entry_resolver.js:131:11)
at Promise.resolve.then.then (D:\Users\cli-quickstart\cli-quickstart\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:238:54) at process._tickCallback (internal/process/next_tick.js:103:7)
webpack: Failed to compile.
实际上是在已经存在的项目中复制并粘贴那个plunker示例。
提前致谢
答案 0 :(得分:1)
假设您使用Angular CLI创建了应用程序,您应该在package.json中导入bootstrap。包看起来像这样:
"bootstrap": "^3.3.7"
然后在npm安装之后你想把它包含在angular-cli.json的样式部分中:
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
]
然后它应该看到你的引导代码。
答案 1 :(得分:0)
错误说明:将一个entryModule传递给插件选项。如同在plunker中一样,您需要在main.ts中引导主模块,如下所示
//main entry point
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app.module';
setTimeout(() =>
platformBrowserDynamic().bootstrapModule(AppModule)
, 2000);