merkle-open/webpack-config-plugins

Webpack resolve extension not working for the TS Plugin

janwidmer opened this issue · 1 comments

I'm submitting a...


[ ] Regression (a behaviour that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behaviour

If you have a project (Nitro for example) and you enable typescript, resolving of the imports do not work.

Example Error, which happens for all imports:

ERROR in ./src/patterns/atoms/image/js/image.ts
Module not found: Error: Can't resolve 'lazysizes/plugins/respimg/ls.respimg' in '/Users/jawidmer/projects/test/src/patterns/atoms/image/js'

Manually setting the extensions in your webpack config fixes the problem:

webpackConfig.resolve.extensions = ['.ts', '.tsx', '.js', '.jsx', '.json', '.d.ts'];

Expected behaviour

Resolving the imports works out of the box, as the extensions for ts get defined here https://github.com/namics/webpack-config-plugins/blob/master/packages/ts-config-webpack-plugin/src/TsConfigWebpackPlugin.js#L73

Minimal reproduction of the problem with instructions

  1. Create new (nitro) project
  2. Enable typescript
  3. Start Server

Environment


Plugin version: 1.3.1
 
- Node version: 10.15.3
- Platform:  Mac

Seems to be a bug in nitro which unsets the .js extension