“Cannot find module” error though build is successful

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 (1,23): Cannot find module 'papaparse'.

WebPack config:

plugins: [
  new webpack.ResolverPlugin(
    new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])


import * as Papa from 'papaparse';

TS files are loaded through ts-loader:

loaders: [
    test: /\.ts$/,
    loader: 'ts-loader?target=es5'

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?

Author: Fantashit

1 thought on ““Cannot find module” error though build is successful

  1. After updating to TS 1.6 it started to print the error code:

    ERROR in ./app/shared/services/papa.service.ts
    (1,23): error TS2307: Cannot find module 'papaparse'.

    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

Comments are closed.