title: How to import npm modules with typescript / gulp / browserify
body: <p>I'm struggling with some very basic things like importing packages I installed with NPM. I honestly tried googling it a lot, and tried out different tutorials, but I can't get it to work. Here is my current setup, trying with gulp, I guess I'm missing something quite basic. I want to be able to use it directly in browser, so I followed a tutorial using browserify (but also tried other tutorials without luck)</p>
  
  <p>I installed (e.g. webmidi via npm) and my folder structure looks like this:</p>
  
  <pre><code>proj
  +--node_modules
      +--module1
      +--module2
      +--webmidi
  +--dist
  +--src
      +--main.ts
      +--index.html
  </code></pre>
  
  <p>My Gulpfile looks like this:</p>
  
  <pre><code>var gulp = require('gulp');
  var webmidi = require('webmidi');
  var browserify = require('browserify');
  var source = require('vinyl-source-stream');
  var tsify = require('tsify');
  var paths = {
      pages: ['src/*.html']
  };
  
  gulp.task('copy-html', function () {
      return gulp.src(paths.pages)
          .pipe(gulp.dest('dist'));
  });
  
  gulp.task('default', gulp.series(gulp.parallel('copy-html'), function () {
      return browserify({
          basedir: '.',
          debug: true,
          entries: ['src/main.ts'],
          cache: {},
          packageCache: {}
      })
      .plugin(tsify)
      .bundle()
      .pipe(source('bundle.js'))
      .pipe(gulp.dest('dist'));
  }));
  </code></pre>
  
  <p>main.ts:</p>
  
  <pre><code>import * as webmidi from "webmidi";
  
  console.log(WebMidi);
  package.json:
  
  {
    "name": "ts4",
    "version": "1.0.0",
    "description": "",
    "main": "./dist/main.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "browserify": "^16.5.0",
      "gulp": "^4.0.0",
      "gulp-require-modules": "^1.1.4",
      "gulp-typescript": "^6.0.0-alpha.1",
      "tsify": "^4.0.1",
      "typescript": "^3.8.2",
      "vinyl-source-stream": "^2.0.0"
    },
    "dependencies": {
      "webmidi": "^2.5.1"
    }
  }
  </code></pre>
  
  <p>and tsconfig.json:</p>
  
  <pre><code>{
      "files": [
          "src/main.ts"
      ],
      "compilerOptions": {
          "noImplicitAny": true,
          "target": "es5"
      }
  }
  </code></pre>
  
  <p>The error I get when i do</p>
  
  <pre><code>&gt;gulp
  [23:36:55] Using gulpfile ~\Documents\Projekte\code\ts4\gulpfile.js
  [23:36:55] Starting 'default'...
  [23:36:55] Starting 'copy-html'...
  [23:36:55] Finished 'copy-html' after 39 ms
  [23:36:55] Starting '&lt;anonymous&gt;'...
  [23:36:57] '&lt;anonymous&gt;' errored after 2.21 s
  [23:36:57] Error: TypeScript error: c:/users/username/documents/projekte/code/ts4/src/main.ts(4,13): Error TS2304: Cannot find name 'WebMidi'.
      at formatError (C:\Users\username\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\format-error.js:21:10)
      at Gulp.&lt;anonymous&gt; (C:\Users\username\AppData\Roaming\npm\node_modules\gulp-cli\lib\versioned\^4.0.0\log\events.js:33:15)
      at emitOne (events.js:121:20)
      at Gulp.emit (events.js:211:7)
      at Object.error (C:\Users\username\Documents\Projekte\code\ts4\node_modules\undertaker\lib\helpers\createExtensions.js:61:10)
      at handler (C:\Users\username\Documents\Projekte\code\ts4\node_modules\now-and-later\lib\mapSeries.js:47:14)
      at f (C:\Users\username\Documents\Projekte\code\ts4\node_modules\once\once.js:25:25)
      at f (C:\Users\username\Documents\Projekte\code\ts4\node_modules\once\once.js:25:25)
      at tryCatch (C:\Users\username\Documents\Projekte\code\ts4\node_modules\async-done\index.js:24:15)
      at done (C:\Users\username\Documents\Projekte\code\ts4\node_modules\async-done\index.js:40:12)
  [23:36:57] 'default' errored after 2.26 s
  </code></pre>
  
  <p>According to <a href="https://github.com/djipco/webmidi/issues/82" rel="nofollow noreferrer">https://github.com/djipco/webmidi/issues/82</a> this is the right way to import WebMidi, and it should work - i guess I'm doing something wrong, can anyone help me?</p>