我正在尝试将 .net Core Angular 4 项目从 Visual Studio 发布到 Azure。在发布过程中,我收到以下错误:
ERROR in ./$$_gendir/~/angular-tree-component/dist/components/tree.component.ngfactory.ts
Module parse failed: C:\projects\DataFinch\Pinnacle\DataFinch.Pinnacle.Web\$$_gendir\node_modules\angular-tree-component\dist\components\tree.component.ngfactory.ts Unexpected token (21:26)
You may need an appropriate loader to handle this file type.
| import * as i10 from 'angular-tree-component/dist/components/tree.component';
| import * as i11 from 'angular-tree-component/dist/models/tree-dragged-element.model';
| const styles_TreeComponent:any[] = ([] as any[]);
| export const RenderType_TreeComponent:i0.RendererType2 = i0.╔╡crt({encapsulation:2,
| styles:styles_TreeComponent,data:{}});
@ ./$$_gendir/ClientApp/app/components/settings/positions/positionsList.component.ngfactory.ts 11:0-127
@ ./$$_gendir/ClientApp/app/app.module.browser.ngfactory.ts
@ ./ClientApp/boot.browser.ts
在我的本地计算机上一切正常,当 env 设置为 prod 时我似乎无法发布:
Update:这是我的Webpack.js https://gist.github.com/chriskooken/afb8785278270e35a38a51f785b9f536 file.
确保您的 webpack 文件包含适当的模块规则:
{ test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, include: [/ClientApp/, /\$\$_gendir/], use: isDevBuild ? ['awesome-typescript-loader?silent=true', 'angular2-template-loader'] : '@ngtools/webpack' },
你可以看看我的 webpack.config.js https://gist.github.com/dasMulli/59596f91de3f139a99931840ba6d4a8a这是为 Angular 5 更新的默认 asp.net core spa Angular 4 模板(直到发布支持 Angular CLI 的 Spa 服务版本)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)