We are using Papaparse from Bower with WebPack and TypeScript 1.5. And though the build is successful (e.g. app is working), we are getting this error in stats.toString()
:
ERROR in /app/shared/services/papa.service.ts
./app/shared/services/papa.service.ts
/app/shared/services/papa.service.ts (1,23): Cannot find module 'papaparse'.
WebPack config:
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
)
],
Import:
import * as Papa from 'papaparse';
TS files are loaded through ts-loader
:
loaders: [
{
test: /\.ts$/,
loader: 'ts-loader?target=es5'
}
]
Papaparse:
bower.json: https://github.com/mholt/PapaParse/blob/master/bower.json
main file to which points bower.json: https://github.com/mholt/PapaParse/blob/master/papaparse.js
How this can be solved?
After updating to
TS 1.6
it started to print the error code:I searched for the code and found this answer: http://stackoverflow.com/a/33403658/4219836
In few words – it happens when there is no definition file for the module that isn’t a TS module