Helpers missing from output file for a TS script (instead of module)
See original GitHub issueI get a Uncaught ReferenceError: __awaiter is not defined
when compiling a file with async. I’m using the latest TypeScript (2.6.2), rollup (0.53.0) and plugin (0.9.0).
main.ts
async function main() {
}
main();
rollup.config.js
import typescript from 'rollup-plugin-typescript2';
export default {
output: {
format: 'iife'
},
plugins: [
typescript()
]
}
tsconfig.json
{
"compilerOptions": {
"lib": [
"es2015"
]
}
}
main.js:
(function () {
'use strict';
function main() {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/];
});
});
}
main();
}());
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
ts is missing from the TypeScript compilation. Please make ...
The @wtw folder is under the node_modules folder. The child project was building the parent package fine when it was in Angular version...
Read more >TSConfig Reference - Docs on every TSConfig option
A TSConfig file in a directory indicates that the directory is the root of a ... these helper functions are instead imported from...
Read more >How we employed the new ECMAScript Module Support in ...
Just by adding type after import tells TS this should not be added to the output file. It then just resolves the type...
Read more >typescript-cheatsheet - GitHub Pages
A set of TypeScript related notes used for quick reference. The cheatsheet contains references to types, classes, decorators, and many other TypeScript ......
Read more >@rollup/plugin-typescript - npm
rollup.config.js import typescript from '@rollup/plugin-typescript'; export default { input: 'src/index.ts', output: { dir: 'output', ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is in 0.10.0
I modified
rollup-plugin-typescript2.cjs.js
innode_modules
to removenoEmitHelpers: true
and didn’t find any duplicates of__awaiter
. I then removedimportHelpers: true
which caused__awaiter$1
to be added to the output. Both modules had async functions in them.To test with
tsc
:tsc main.ts --importHelpers --module es2015 --lib es2015 --moduleResolution node
main.ts:
module.ts:
main.js:
module.js