plugins: [commonjs] named export missing with v13 + dynamic imports

  • Rollup Plugin Name: @rollup/plugin-commonjs
  • Rollup Plugin Version: 13.0.0
  • Rollup Version: 2.18.0
  • Operating System (or Browser): Firefox 77
  • Node Version: v12.18.1

How Do We Reproduce?

I’m including fabricjs via dynamic imports and the update from v12 to v13 removed the named export. Static imports still work though.

async function foo() {
    const x = (await import('fabric')).fabric;
    console.log(x); // this is undefined but wasn't with 12.0.0
}

foo();

This works though

import {fabric} from 'fabric';

I’ve created a small reproducer: https://github.com/lazka/rollup-bug-dynamic-import-exports

Expected Behavior

Named exports work the same with dynamic imports as with non-dynamic ones

Actual Behavior

They are missing in the dynamic case.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (4 by maintainers)

Most upvoted comments

There will be a fix in Rollup, see rollup/rollup#3648. I will put it into the next patch release. This should fix this bug without necessary changes to this plugin.