Почему Rollup создает блок фасадов для моего Angular пакета приложений и как его исправить? - PullRequest
1 голос
/ 28 апреля 2020

У меня есть приложение Angular 9 , и я создаю свои пакеты с помощью Rollup и Bazel. Таким образом, у меня есть правило rollup_bundle, которое выглядит следующим образом: this :

rollup_bundle(
    name = "bundle",
    config_file = "//packages/angular-bazel:rollup.config.js",
    entry_points = {
        ":main.prod.ts": "index.es2015",
    },
    output_dir = True,
    deps = [
        ":prod_src",
        "@npm//rollup-plugin-commonjs",
        "@npm//rollup-plugin-node-resolve",
    ],
)

Вот rollup.config. js Я использую:

const node = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');

module.exports = {
  plugins: [
    node({
      mainFields: ['browser', 'es2015', 'module', 'jsnext:main', 'main'],
    }),
    commonjs(),
  ],
  onwarn: function (warning) {
    if (warning.code === 'THIS_IS_UNDEFINED') {
      return;
    }
    console.warn(warning.message);
  },
};

Но во время связывания я получаю сообщение о том, что Rollup создал кусок фасада. Таким образом, у меня есть, казалось бы, избыточный файл javascript.

INFO: From Bundling JavaScript services/client/bundle [rollup]:

bazel-out/k8-fastbuild/bin/services/client/main.prod.mjs → bazel-out/k8-fastbuild/bin/services/client/bundle...
To preserve the export signature of the entry module "bazel-out/k8-fastbuild/bin/services/client/main.prod.mjs", an empty facade chunk was created. This often ha
ppens when creating a bundle for a web app where chunks are placed in script tags and exports are ignored. In this case it is recommended to set "preserveEntrySi
gnatures: false" to avoid this and reduce the number of chunks. Otherwise if this is intentional, set "preserveEntrySignatures: 'strict'" explicitly to silence this warning.
created bazel-out/k8-fastbuild/bin/services/client/bundle in 2.9s
INFO: From Bundling JavaScript services/client/bundle [rollup] [for host]:

bazel-out/host/bin/services/client/main.prod.mjs → bazel-out/host/bin/services/client/bundle...
To preserve the export signature of the entry module "bazel-out/host/bin/services/client/main.prod.mjs", an empty facade chunk was created. This often happens wh
en creating a bundle for a web app where chunks are placed in script tags and exports are ignored. In this case it is recommended to set "preserveEntrySignatures: false" to avoid this and reduce the number of chunks. Otherwise if this is intentional, set "preserveEntrySignatures: 'strict'" explicitly to silence this warning.
created bazel-out/host/bin/services/client/bundle in 3s

Вот структура каталогов моего приложения

assets
app
shared
environment
features
  login
    store
  user
    store
  ideas
    store
store

Но я думаю, чтобы найти root причину, по которой мы должны смотреть на фактические исходные файлы: https://github.com/flolu/centsideas/tree/7c4398d8ca407aefe46fdedab1ac5b11faac75dd/services/client

...