1

現在、app.js で約 5 MB、ベンダー js で 1 MB 以上のかなり大きなアプリケーションがあります。10MB を超えると思います。ターゲット ユーザーは低速のインターネットを使用しており、各ユーザーは異なる権限を持っているため、ユーザーはほとんどのコンポーネントを利用できません。

ビルド プロセスからいくつかの大きなコンポーネントを除外し、オンデマンドでロードすることを考えていました。これまでのところ、このアイデアが気に入りましたhttps://github.com/Cryrivers/ember-remote-component/blob/master/app/components/remote-component.jsコンポーネントがロードされているかどうかをチェックします。 AJAX

何かのようなもの

if(!container.hasRegistration(`component:${ componentName }`)){
    $.when(
        $.getScript(`/remote-components/${ componentName }/component.js`),
        $.getScript(`/remote-components/${ componentName }/template.js`)
    ).done(()=> {
        let container = getOwner(this);
        container.register(`component:${ componentName }`, require(`${ ENV.modulePrefix }/components/${ componentName }`).default, {singleton: false});
        this.set('isLoaded', true);
    })
}

これはうまくいくと思います。しかし、ここで2つの質問があります

A:ビルド プロセスからコンポーネントを除外し、連結を停止すると同時に/dist/components/abc/フォルダーに保持する方法

B: AJAX 経由でロードした後にテンプレートをコンパイルすると、パフォーマンスに大きな問題が発生するため、そのコンポーネントの template.hbs を template.js にコンパイルします。

4

1 に答える 1