3

私の目的は、「通常の」親 SPAWordpress サイトで使用できる Angular Web コンポーネントを開発することです。

Wordpress サイトで Web コンポーネントを使用する場合、ngx-build-plus を使用してすべてを 1 つのバンドルにパッケージ化します。. これはうまくいきます。

ただし、親の Angular アプリケーションの Web コンポーネントを提供するときは、バンドルの Angular 部分を避けたいと思います (既に存在しているため)。readme に記載されている差分読み込みのブログ/ガイドに従っていますが、このエラーで立ち往生しています (root.component は Web コンポーネントの名前です)。

root.component.ts:10 Uncaught TypeError: Cannot read property 'ɵɵdefineComponent' of undefined
    at root.component.ts:10
    at Module../src/app/root.component.ts (root.component.ts:16)
    at __webpack_require__ (bootstrap:19)
    at Module../src/app/app.module.ts (app.module.ts:1)
    at __webpack_require__ (bootstrap:19)
    at Module../src/main.ts (main.ts:1)
    at __webpack_require__ (bootstrap:19)
    at Object.0 (main.ts:22)
    at __webpack_require__ (bootstrap:19)
    at bootstrap:83
    at bootstrap:83

次のものを提供すると、上記のエラーが発生します。

ng s --extra-webpack-config projects/<name-of-project>/webpack.externals.js --output-hashing=none --project eddy-library --single-bundle

説明されているように、正常に動作します(ただし、angular を含む大きなバンドルが作成されます)。

ng s --project <name-of-project> --single-bundle

どんな助けでも大歓迎です。サンプルリポジトリからすべてをコピーしようとしましたが、助けにはなりませんでした

4

0 に答える 0