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

Can't test existence of export when using externals #1801

Closed
Janpot opened this issue Nov 24, 2021 · 0 comments
Closed

Can't test existence of export when using externals #1801

Janpot opened this issue Nov 24, 2021 · 0 comments

Comments

@Janpot
Copy link

Janpot commented Nov 24, 2021

// ./index.js
import * as external from 'external';
console.log(`External has export "nonExisting": ${!!external.nonExisting}`);

Build as

esbuild index.js --bundle --outfile=out.js --external:external --format=esm

Results into

// index.js
import {
  nonExisting
} from "external";
console.log(`External has export "nonExisting": ${!!nonExisting}`);

Which has different runtime behavior than the original. It will fail importing instead of logging "External has export "nonExisting": false"

Uncaught SyntaxError: The requested module '...external' does not provide an export named 'nonExisting'
@evanw evanw closed this as completed in 44b2665 Dec 3, 2021
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