Skip to content

mjackson/esbuild-empty-file-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a repro of what I think might be a bug in esbuild where it interprets an empty file as a module with a default export when it is imported via import *.

To reproduce:

  • Make sure you have node 14 or newer (so you can run ESM w/out compiling anything)
  • Run b.mjs with node:
$ node b.mjs

You should see the following console output:

[Module] {  }

It's an empty module (no exports).

  • Next, run install + esbuild:
$ npm install
$ esbuild --bundle --outfile=out.js b.mjs
  • Now, run the esbuild output:
$ node out.js

You should see the following console output:

{ default: {} }

The built module is an object with a single default export which is an empty object.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published