In JavaScript, node.js, when I export module using CommonJS style, such as
module.export.foo = (param) => {
// do sth here
return value
}
and I start typing foo
in the other file in my node.js project, VS Code suggests: "Auto import from 'path/to/file'" after pressing enter, VS Code inserts statement at the top of the file:
import { foo } from 'path/to/file'
I'd like VS code to paste following code instead:
const { foo } = require('path/to/file')
Is it possible?
My jsconfig.json
looks like that:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6"
},
"include": [
"src/**/*",
"__tests__/**/*"
]
}