How to add a typescript definition file to a npm package?

There is a page in the TypeScript Handbook on adding typings to an NPM Package. I’ll copy and paste here: Typings for NPM Packages The TypeScript compiler resolves Node module names by following the Node.js module resolution algorithm. TypeScript can also load typings that are bundled with npm packages. The compiler will try to discover … Read more

All NPM commands error with TypeError: Class extends value undefined is not a constructor or null

I had the same issue. Had some older npm installation and when I ran the windows installer it failed. I did the following: use the installer (https://nodejs.org/en/download/) to remove node,npm delete from c:/Users/YOURUSER/AppData/Roaming/npm-cache and nvm folders if available remove c:/Program Files/node if available remove Environment Variables all settings for NPM and NODE. There are both … Read more

With Webpack, is it possible to generate CSS only, excluding the output.js?

There is an easy way, no extra tool is required. There is an easy way and you don’t need extra libraries except which you are already using: webpack with the extract-text-webpack-plugin. In short: Make the output js and css file have identical name, then the css file will override js file. A real example (webpack … Read more

version bump when updating readme for npm package?

Depending on your definition of “need to”, this could be two very different questions: [Is it ok to publish readme changes without bumping the version number?] [Is it technically possible to publish changes without incrementing the version] The accepted answer (updating via npm publish –force, i.e. without incrementing any part of the version number) is … Read more

Can I run a private npm repository without replicating the public repository?

I just set this up for my work. Here’s what I did: Setup empty NPM registry: I followed the instructions from this fork of npmjs.org, which adds much improved documentation. Setup Kappa: I used Kappa, a great npm proxy from Paypal. (I’m guessing they have a very similar use case to most people who want … Read more

Mocha tests don’t run with Webpack and mocha-loader

Mocha loader won’t run tests while building, it’s used to create a bundle specifically containing your tests which you can then run from your browser. I would recommend creating a separate webpack config file for your tests, which you can then host on a webpack-dev-server that uses a different port from your application. Here’s an … Read more