An import path cannot end with '.ts' - NodeJS and Visual Code An import path cannot end with '.ts' - NodeJS and Visual Code express express

An import path cannot end with '.ts' - NodeJS and Visual Code


This is what I use and it works pretty well.

Full webpack config here: https://gist.github.com/victorhazbun/8c97dc578ea14776facef09a115ae3ad

webpack.config.js

'use strict';const webpack = require('webpack');module.exports = {  ...  resolve: {    extensions: [".ts", ".tsx", ".js"]  },  ...};


I had this issue and it took me the better part of an hour to realize all I had to do was remove the .ts extension from the import. For me:

 // index.tsimport { renderSection, useConfig, writeToFile } from './hooks.ts'// changed from `./hooks.ts` to `./hooks`import { renderSection, useConfig, writeToFile } from './hooks'


I had the same problem and the solution for me was to just re-run the application. In my case, I had just finished converting some files to .tsx, perhaps it explains it.