Using TypeScript, Browserify, and SVG.js

372 Views Asked by At

First off: I am completely new to Node.js, so please bear over with me if this is a dumb question.

I am trying to get browserify and tsify to work with TypeScript and the SVG.js library. As far as I understand, I should be able to

  1. Write TypeScript code that uses the SVG.js library
  2. Compile this code to vanilla JS and bundle it together with the library itself for use in the browser using browserify and tsify

Step 1 is easy, but Step 2 is causing me problems. Even if I write the simplest of TypeScript programs containing only the line import * as SVGJS from 'svg.js', and then run the command specified in the tsify docs (browserify main.ts -p [ tsify --noImplicitAny ] > bundle.js), the compiled bundle.js file has the following contents:

enter image description here Here, I was expecting to see the the code for the entire SVG.js library. At least that's what I get if I create a vanilla JS file containing var SVGJS = require('svg.js') and run browserify on that.

Can anybody tell me what I am doing wrong? I have installed all the required node modules, and am getting no warnings or errors during compilation. Please let me know if I need to provide more information.

0

There are 0 best solutions below