设置具有角度通用性,赛普拉斯打字问题的nrwl / nx工作区

时间:2019-02-06 13:42:35

标签: angular typescript webpack cypress nrwl

TL; DR

运行Cannot find name 'cy'.时出现错误create-nx-workspace nx-workspace-with-ssr --yarn

回购示例: Branch showing error


错误说明

嗨,我正在尝试建立一个最低限度的可行产品项目,以便在angular universal内测试nrwl/nx workspace

大多数设置都是使用ng cli和nrwl / nx原理图完成的:

  • ng g app nx-app
  • yarn update (update using the nrwl/nx schematic)(用于测试的笑话和木)
  • ng g universal (nrwl/nx schematic for setting up universal)
  • yarn webpack:server

完成此步骤后,我尝试遵循the following guide来说明如何构建和提供服务 ssr应用程序。

我更改了示例脚本中的路径以匹配我的nx项目。

运行Cannot find name 'cy'.时出现错误apps/nx-app-e2e/

我认为这很奇怪,因为我什至不想从tsconfig*文件夹中构建文件。因此,我想某些Angular CLI: 7.3.0 Node: 10.14.1 OS: win32 x64 Angular: 7.2.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, platform-server, router Package Version ----------------------------------------------------------- @angular-devkit/architect 0.11.4 @angular-devkit/build-angular 0.11.4 @angular-devkit/build-optimizer 0.11.4 @angular-devkit/build-webpack 0.11.4 @angular-devkit/core 7.3.0 @angular-devkit/schematics 7.3.0 @angular/cli 7.3.0 @ngtools/webpack 7.1.4 @schematics/angular 7.3.0 @schematics/update 0.13.0 rxjs 6.4.0 typescript 3.2.4 webpack 4.23.1 文件存在问题,但我似乎找不到问题。

设置

$ yarn webpack:server
yarn run v1.13.0
$ webpack --config webpack.server.config.js --progress --colors
Hash: d991a357a6372aad06d8
Version: webpack 4.23.1
Time: 8716ms
Built at: 02/06/2019 2:24:07 PM
 1 asset
Entrypoint server = server.js
  [1] ./node_modules/@angular/core/fesm5/core.js + 4 modules 974 KiB {0} [built] [2 warnings]
      |    5 modules
  [4] ./node_modules/rxjs/_esm5/internal/Observable.js + 2 modules 5.33 KiB {0} [built]
      |    3 modules
 [11] external "path" 42 bytes {0} [built]
 [12] ./node_modules/@ngrx/store/fesm5/store.js + 10 modules 43.8 KiB {0} [built]
      |    11 modules
 [27] external "fs" 42 bytes {0} [built]
 [47] ./node_modules/@ngrx/effects/fesm5/effects.js + 4 modules 21.7 KiB {0} [built]
      |    5 modules
 [55] external "url" 42 bytes {0} [built]
 [85] external "events" 42 bytes {0} [built]
 [86] external "crypto" 42 bytes {0} [built]
[106] ./node_modules/@angular/platform-server/fesm5/platform-server.js + 2 modules 1.24 MiB {0} [built]
      |    3 modules
[109] ./apps/nx-app/src lazy namespace object 160 bytes {0} [built]
[158] external "timers" 42 bytes {0} [optional] [built]
[245] ./dist/apps/nx-app-server/main.js 39.7 KiB {0} [built]
[261] ./node_modules/@nrwl/nx/esm5/nrwl-nx.js + 17 modules 308 KiB {0} [built]
      |    18 modules
[262] ./server.ts + 1 modules 5.38 KiB {0} [built]
      | ./server.ts 1.81 KiB [built]
      |     + 1 hidden module
    + 358 hidden modules

WARNING in ./node_modules/@angular/core/fesm5/core.js 18261:15-36
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
 @ ./server.ts 5:0-47 11:0-14

WARNING in ./node_modules/@angular/core/fesm5/core.js 18273:15-102
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
 @ ./server.ts 5:0-47 11:0-14

ERROR in C:\Development\Temp\nx-worspace-with-ssr\apps\nx-app-e2e\src\integration\app.spec.ts
[tsl] ERROR in C:\Development\Temp\nx-worspace-with-ssr\apps\nx-app-e2e\src\integration\app.spec.ts(4,20)
      TS2304: Cannot find name 'cy'.

ERROR in C:\Development\Temp\nx-worspace-with-ssr\apps\nx-app-e2e\src\support\app.po.ts
[tsl] ERROR in C:\Development\Temp\nx-worspace-with-ssr\apps\nx-app-e2e\src\support\app.po.ts(1,34)
      TS2304: Cannot find name 'cy'.
error Command failed with exit code 2.

故障日志

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"             
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"             
         x:Class="XamarinCertUnderstanding.Views.MainPage">
<StackLayout Margin="0, 15, 0, 0">
    <Button VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" BorderColor="Black" BackgroundColor="Blue" Command="{Binding AddButton}" TextColor="Green" Text="Add Button"/>
    <ListView x:Name="MainList" ItemsSource="{Binding DefaultModels}" BackgroundColor="Transparent" HasUnevenRows="True"
              SeparatorVisibility="Default" Margin="0, 15, 0, 0">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <StackLayout BackgroundColor="White" Spacing="10" >
                            <Entry  Text="{Binding Name,Mode=TwoWay}" Placeholder="Name" FontSize="20" BackgroundColor="White"/>
                            <TimePicker  Time="{Binding Arrival,Mode=TwoWay}" FontSize="20"  BackgroundColor="White"/>
                            <Entry  Text="{Binding Description,Mode=TwoWay}" Placeholder="Description" FontSize="20" BackgroundColor="White"/>
                            <TimePicker  Time="{Binding Depart,Mode=TwoWay}" FontSize="20" BackgroundColor="White"/>
                            <Entry  FontSize="20" Text="{Binding Sign,Mode=TwoWay}" Placeholder="Sign" BackgroundColor="White"/>
                        </StackLayout>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</StackLayout>
</ContentPage>

1 个答案:

答案 0 :(得分:2)

设法通过更改某些文件的结构来构建ssr。 View commit here