highlight.js: Won't work when installed from npm.

The client side version seems to not be included inside the npm package of the library.

When trying to load node_modules/highlight.js/lib/highlight.js an error is thrown :

Uncaught ReferenceError: module is not defined.

I guess the client side version of the library should be packaged with it so that the module can be installed from npm.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

npm is desined for server-side usage. You can use npm version with broserify or use third-party bower/composer/components package of highlight.js, e.g. https://github.com/components/highlightjs.

@isagalaev I guess you just decide, we just need npm to work and to be able to select the languages we want. It’s obviously impossible to publish on npm all combinations of languages.

People want files to work on GitHub master? Thats ok, but what files?

My suggestion is that github must be the place for source files not builds. You can have a pipeline to upload builds to the builds sections if needed.

On npm we should be able to find alla languages and core available as single require or src for the browser. Concat + minify has to be developer responsibility or CDN responsibility.

The final cherry is to make custom build installable using npm.

Note that @kilianc’s gulp code doesn’t work right after installing via npm:

Error: Cannot find module 'highlight.js/tools/build.js'

The build script is not included in the npm package

2019 and still not fixed. Please reopen the issue. I try to install typedoc which is running server side.

Ignore me: existing related issue https://github.com/highlightjs/highlight.js/issues/1984