Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugin-terser] Minified UMD with default terser options cannot be consumed from ES6 #1674

Open
springcomp opened this issue Feb 8, 2024 · 0 comments

Comments

@springcomp
Copy link

  • Rollup Plugin Name: @rollup/plugin-terser
  • Rollup Plugin Version: ^0.4.4
  • Rollup Version: 2.79.1
  • Operating System (or Browser): Linux
  • Node Version: 18.18.0
  • Link to reproduction : StackBlitz repro.

Expected Behavior

Run the following command:

npm run build
npm run exec:dev

This generates a dist/sayHi.umd.min.js minified UMD module that is consumed as a CommonJS module from apps/dev/main.js using the require() instruction.

This produces the following output:

[Function (anonymous)]
Hello, John!
Good bye, John!

I would expect the same output when consuming the module as a ECMAScript module using the import instruction.

Actual Behavior

Run the following command:

npm run build
npm run exec:build

This generates a dist/sayHi.umd.min.js minified UMD module that is consumed as an ECMAScript module from apps/build/main.js using the import instruction.

This produces the following output:

file:///home/projects/rollup-repro-id5i6z/apps/build/main.js:5
import { sayGoodbye, sayHi } from '../../dist/sayHi.umd.min.js';
         ^^^^^^^^^^
SyntaxError: The requested module '../../dist/sayHi.umd.min.js' does not provide an export named 'sayGoodbye'
    at ModuleJob._instantiate (https://rollupreproid5i6z-kjjj-8fvnx673.w-corp.staticblitz.com/blitz.a9c8a5a3.js:181:1509)
    at async ModuleJob.run (https://rollupreproid5i6z-kjjj-8fvnx673.w-corp.staticblitz.com/blitz.a9c8a5a3.js:181:2327)

Additional Information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant