plantain-00 / expression-engine

An expression tokenizer, parser and evaluator.
MIT License
8 stars 1 forks source link

Cannot load library directly from node #3

Closed djelic closed 4 years ago

djelic commented 4 years ago

Hi,

first of all, great library! One thing though, library is not compiles to work from node without TypeScript. Consider setting importHelpers: false in tsconfig.base.json since setting it to true adds dependency on tslib.

Version(if relevant): 1.7.3

Environment(if relevant): node v10

Code(if relevant):

yarn add expression-engine
const ee = require('expression-engine')

Expected:

To load expression-engine successfully.

Actual:

Thrown:
{ Error: Cannot find module 'tslib'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18) code: 'MODULE_NOT_FOUND' }
plantain-00 commented 4 years ago

v1.7.4 should fix this. importHelpers: true will not inline helper functions, so will reduce the generated js file size, it's better for frontend usage, so I just added tslib as a dependency to fix this.

djelic commented 4 years ago

Can confirm it works, thanks!