Tools: [bundler] Multiple import() statements for the same fragment breaks bundles

Created on 9 Jul 2018  路  8Comments  路  Source: Polymer/tools

When I edit:

https://github.com/Polymer/pwa-starter-kit/blob/b50a93748677c8be0bdcdc5ed71a03747628fc57/src/actions/app.js#L31-L39

  switch(page) {
    case 'view1':
      import('../components/my-view1.js').then((module) => {
        // Put code in here that you want to run every time when
        // navigating to view1 after my-view1.js is loaded.
      });
      break;
    case 'view2':
      import('../components/my-view2.js');
      break;

To:

    case 'view1':
      import('../components/my-view1.js').then((module) => {
        // Put code in here that you want to run every time when
        // navigating to view1 after my-view1.js is loaded.
      });

      import('../components/my-view2.js');

      break;
    case 'view2':
      import('../components/my-view2.js');
      break;

The resulting shell bundle (my-app.js) doesn't export some identifiers used by the fragments like LitElement and html.

Ref https://github.com/Polymer/pwa-starter-kit/issues/190

bundler High In Progress Bug

Most helpful comment

This is a serious bug, not very encouraging that it's been open since july :(

All 8 comments

@usergenic any news about this? 馃檪

This is a serious bug, not very encouraging that it's been open since july :(

Strangely hit this two days ago and it took a while to unwind it

FWIW, working on this via Polymer/tools#722 - rollup has some unfortunate assumptions and its own new logic around deduplicating dynamic imports that I'm attempting to get around. Solution soon.

Filed another bug on rollup https://github.com/rollup/rollup/issues/2489

Was this page helpful?
0 / 5 - 0 ratings