https://github.com/ofhouse/ncc-bug-esmoduleinterop
Documents a discrepancy between JavaScript and TypeScript bundles when using esModuleInterop
https://github.com/ofhouse/ncc-bug-esmoduleinterop
Last synced: about 1 month ago
JSON representation
Documents a discrepancy between JavaScript and TypeScript bundles when using esModuleInterop
- Host: GitHub
- URL: https://github.com/ofhouse/ncc-bug-esmoduleinterop
- Owner: ofhouse
- Created: 2020-05-19T19:20:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-19T21:06:52.000Z (almost 5 years ago)
- Last Synced: 2025-02-28T05:21:01.465Z (2 months ago)
- Language: TypeScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `@zeit/ncc` bug with `esModuleInterop=true`
This repository is a reproduction of a bug with the ncc compiler:
## TypeScript (`esModuleInterop: false`)
This is the normal setting which includes the required asset `test.txt`
### Files
```ts
// tsconfig.json
{
"compilerOptions": {
"esModuleInterop": false
}
}import * as fs from 'fs';
import * as path from 'path';const file = fs.readFileSync(path.join(__dirname, 'test.txt'));
console.log(file);
```### Output
```sh
index.js
test.txt
```## TypeScript (`esModuleInterop: true`)
### Files
```ts
// tsconfig.json
{
"compilerOptions": {
"esModuleInterop": true
}
}import * as fs from 'fs';
import * as path from 'path';const file = fs.readFileSync(path.join(__dirname, 'test.txt'));
console.log(file);
```### Output
```sh
index.js
```