tsconfig-paths icon indicating copy to clipboard operation
tsconfig-paths copied to clipboard

[question] is it possible to resolve js files when using "allowjs"?

Open sandervspl opened this issue 6 years ago • 1 comments

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!)

sandervspl avatar Jan 11 '19 10:01 sandervspl

Cool, I figured it out. Passing extensions to the constructor worked.

new TsconfigPathsPlugin({
  extensions: ['.js', '.jsx', '.ts', '.tsx'],
}),

sandervspl avatar Jan 11 '19 13:01 sandervspl