角度通用(SSR)和Ckeditor 4错误

时间:2018-04-11 07:49:56

标签: angular webpack ckeditor ssr

我使用角度通用SSR我的网络应用程序。在某些组件中,我使用了ng2-ckeditor。当我编译webpack并构建server.js文件然后运行node server.js时,下面的错误显示多个:

    CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)
CKEditor 4.x is missing (http://ckeditor.com/)

我该如何解决这个问题? 谢谢你的帮助

1 个答案:

答案 0 :(得分:0)

为CKEdotor使用模拟模块。 您可以查看示例:

@NgModule({
  imports: [
    CommonModule,
    MockServerBrowserRoutes,
    environment.isServer ? [MockServerModule] : [MockBrowserModule],
    TranslateModule,
  ],
  declarations: [MockServerBrowserComponent],
})
export const environment = {
  production: false,
  isServer: false,
  // for prerender
  host: 'http://localhost:4000',
};
...
 "server": {
          "builder": "@angular-devkit/build-angular:server",
          "options": {
            "outputPath": "dist-server",
            "main": "src/main.server.ts",
            "tsConfig": "src/tsconfig.server.json"
          },
          "configurations": {
            "dev": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/server/environment.ts"
                }
              ]
            },
...