Async functions emit Rollup warning `this has been rewritten to undefined` -- can't repro
See original GitHub issueWhen I try to build a file containing async functions, there’s the following warning:
this has been rewritten to undefined
Environment
- node v10.16.0
- rollup-plugin-node-resolve (^5.2.0)
- rollup-plugin-typescript2 (^0.24.2)
- rollup-plugin-babel (^4.3.3)
- rollup-plugin-commonjs (^10.1.0)
- rollup-plugin-terser (^5.1.2)
Versions
- typescript: ^3.6.3
- rollup: ^1.21.4
- rollup-plugin-typescript2: ^0.24.2
rollup.config.js
import resolve from 'rollup-plugin-node-resolve'
import typescript from 'rollup-plugin-typescript2'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import { terser } from 'rollup-plugin-terser'
import pkg from './package.json'
const extensions = ['.js', '.jsx', '.ts', '.tsx']
export default {
input: ['src/index.ts'],
output: {
file: pkg.main,
format: 'cjs'
},
external: ['@slack/client', 'dlv', 'dotenv', 'googleapis', 'micro'],
plugins: [
resolve({ extensions }),
typescript({
useTsconfigDeclarationDir: true
}),
babel(),
commonjs(),
terser()
]
}
tsconfig.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"target": "es2015",
"module": "es2015",
"resolveJsonModule": true,
"esModuleInterop": true,
"declaration": true
},
"include": ["src/**/*.ts"],
"types": ["node"]
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[rollup/module/async]: `this` has been rewritten to `undefined`
The warning came from an await shim from typescript. I'm not sure why it's there but fiddling around the typescript configuration should help ......
Read more >rollupjs - How to avoid "`this` has been rewritten to `undefined ...
When building the project with rollup I get the warning. this has been rewritten to undefined. With pointing at last line of code...
Read more >Cleaning up Async Functions in React's useEffect Hook ...
Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application....
Read more >2 Server Error Message Reference - MySQL :: Developer Zone
Message: The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been translated to SET SQL_LOG_BIN.
Read more >Rollup-plugin-regenerator - npm.io
I have a warning by Rollup: The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has...
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
Alright, I think I’m just going crazy. The error has disappeared, I can not re-create it. Well… so i’m closing this 🤷🏻♂️ Sorry for making you waste time @ezolenko
I think this is a problem with your code, read the description at that rollup link: https://rollupjs.org/guide/en/#error-this-is-undefined