环境
-
electron-forge,5.1.1
-
电子编译,6.4.2
-
angular,5.2.9
脚步
-
使用伪造模板创建了电子项目 . 一切正常 .
-
npm install -g electron-forge
-
electron-forge init my-new-project --template=angular2
-
cd my-new-project
-
npm start
-
使用cli在单独的文件夹中创建了角度项目,并且angular已在浏览器中启动并运行 .
-
迁移了电子项目中src文件夹下的角度文件 .
-
在电子项目中添加了角度相关的依赖关系,例如@ angular / router .
-
到目前为止,这些文件位于src文件夹下,电子应用程序运行良好 .
-
index.ts
-
index.html
-
bootstrap.ts
-
app.component.ts
-
app.component.html
-
app.component.css
-
app.module.ts
-
然后我刚刚添加了这些文件
-
app-routing.module.ts
-
角色
-
roles.module.ts
-
roles-routing.module.ts
-
roles.component.ts
-
roles.component.html
-
更新这些文件
-
index.html,头部为
<base href="">
.
带有loadChildren属性的 -
app-routing.module.ts . const routes:Routes = [{path:'roles',loadChildren:'roles/roles.module#RolesModule'},{path:'', redirectTo: ' roles ', pathMatch: ' full'}];
-
roles-routing.module.ts
const routes:Routes = [{path:'',component:RolesComponent,}];
所有这些更改都在浏览器中使用角度,但在电子应用程序中出错 .
Error: Reference error. System is not defined.
任何帮助,将不胜感激 .