I'm putting together a small application using angular-cli and I am trying to integrate PrismJS but facing issues with making it function properly.
Essentially, I've set up a vendor directory where I have placed Prism's scripts and styles, loading them in the index.html.
Additionally, I need to include type definitions to ensure my app compiles correctly:
npm i --save-dev @typings/prismjs
After that, I should be able to call Prism.whatever()
anywhere within my code, however, this is not working as expected.
Even my IDE is unable to identify the namespace Prism
.
Upon inspecting the content of the definition file (index.d.ts
), I noticed that starting from version 1.6, it no longer includes
declare var Prism : PrismJS.Prism;
Instead, there is just an export namespace Prism
. This led me to question whether I need to import something since there are no declare
statements present.
To address this, I decided to revert to an older version of the definition (1.4.16) which does include
declare var Prism : PrismJS.Prism;
Now, my IDE (webstorm) recognizes Prism
. However, when attempting to compile, webpack still throws an error:
Cannot find name 'Prism'
My query is quite straightforward: what am I missing here?
Apologies for the seemingly obvious inquiry.
Thank you!