LearningProcesss / boardgamegeekjsclient

Typescript written API wrapper for Boardgamegeek XML2 API
MIT License
18 stars 6 forks source link

Error with NODE_ENV=production #7

Closed MrMory closed 2 years ago

MrMory commented 3 years ago

If you use your package within a node environment that sets the environment variable to 'production'. You get the following error:

[SyntaxError]: [1:17]: Invalid keyword at a (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:112106) at ee (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:144651) at rt (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:178509) at he (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:152021) at /Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:148558 at _e (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:148613) at Module.Dt (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:202224) at Object.t.getArgumentNames (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:14722) at e.parseMethodArguments (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:85595) at e.parseJsonCreator (/Users/Marijn/Documents/Programming/bgg-test/node_modules/jackson-js/dist/lib.node.js:16:81156) { index: 17, line: 1, column: 17, description: '[1:17]: Invalid keyword', loc: { line: 1, column: 17 } }

You can reproduce this by running a simple node script:

index.js

const { BggClient } = require('boardgamegeekclient');

const bggClient = BggClient.Create();

async function main() {
        const response = await bggClient.collection.query({ username: 'mattiabanned' });
        console.log(response);
}

main();

export NODE_ENV=production node index.js

MrMory commented 3 years ago

you also need to install tslib as a dependency

LearningProcesss commented 3 years ago

Hi, thank you for pointing out all these issues. I think that my latest #9 solves all of them. Unfortunately seems that TSDX pollute the output build with TSLIB references, thats why we were forced to install it. try 1.0.0.7 version Let me know.