Skip to content

'import' and 'export' may only appear at the top level #304

Description

@maneetgoyal
  • Rollup Plugin Name:
  • Rollup Plugin Version: @rollup/plugin-commonjs
  • Rollup Version: 11.1.0
  • Operating System (or Browser): Mac OS
  • Node Version: 12.13.1

How Do We Reproduce?

Expected Behavior

Bundling worked with lodash-es without any issues till v. 11.0.2.

Actual Behavior

!] Error: 'import' and 'export' may only appear at the top level
abc: ../../node_modules/lodash-es/isBuffer.js (1:0)
abc: 1: import root from './_root.js';
abc:    ^
abc: 2: import stubFalse from './stubFalse.js';
abc: Error: 'import' and 'export' may only appear at the top level
abc:     at error (/xxx/node_modules/rollup/dist/shared/rollup.js:10399:30)
abc:     at Module.error (/xxx/node_modules/rollup/dist/shared/rollup.js:14789:16)
abc:     at tryParse (/xxx/node_modules/rollup/dist/shared/rollup.js:14682:23)
abc:     at Module.setSource (/xxx/node_modules/rollup/dist/shared/rollup.js:15080:30)
abc:     at /xxx/node_modules/rollup/dist/shared/rollup.js:17086:20
abc:     at runNextTicks (internal/process/task_queues.js:58:5)
abc:     at processImmediate (internal/timers.js:412:9)
abc:     at async Promise.all (index 114)
abc:     at async Promise.all (index 5)
abc:     at async Promise.all (index 0)
abc: error Command failed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions