tsconfig-paths
tsconfig-paths copied to clipboard
[question] is it possible to resolve js files when using "allowjs"?
My team wants to transition to TypeScript, so to make the transition easier for them I want to allow .js files for now.
I'm using Webpack and webpack-dev-server to run my dev environment.
I have this in my webpack resolve
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx'],
plugins: [
new TsconfigPathsPlugin(),
],
},
However, it does not resolve js files without adding .js or directly going to the file instead of grabbing the index of the folder (i.e. I want to write components/button but I have to write components/button/index.js)
I can't find anything in the readme or on Google regarding this topic (maybe it's not even related to this package, if that's the case: sorry!)
Cool, I figured it out. Passing extensions to the constructor worked.
new TsconfigPathsPlugin({
extensions: ['.js', '.jsx', '.ts', '.tsx'],
}),