-5

How can one include the

Jison

javascript library into an angular project?

At the moment I'm getting:

WARNING in ./node_modules/jison/node_modules/source-map/lib/source-map/source-node.js 8:45-52 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

and

GET http://localhost:4200/vendor.bundle.js net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK) inline.bundle.js:55 Uncaught TypeError: Cannot read property 'call' of undefined at webpack_require (inline.bundle.js:55)

mluis
  • 213
  • 2
  • 13

1 Answers1

0

Install to your projects package.json

npm install jison -s

In your tsconfig.app.json include 'node' in your types array within compilerOptions

"compilerOptions": {
    "types": [
       "node"
    ]
}

Then import it in any TypeScript file.

import * as jison from 'jison';
Levi Barker
  • 102
  • 11
  • I'm getting: `WARNING in ./node_modules/jison/node_modules/source-map/lib/source-map/source-node.js 8:45-52 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted` – mluis Nov 12 '18 at 12:27
  • and also `GET http://localhost:4200/vendor.bundle.js net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK) inline.bundle.js:55 Uncaught TypeError: Cannot read property 'call' of undefined at __webpack_require__ (inline.bundle.js:55)` – mluis Nov 12 '18 at 12:28
  • I was missing "module": "commonjs" in my tsconfig.json also. – mluis Nov 22 '18 at 13:32