AndreasMadsen / async-hook

Inspect the life of handle objects in node
MIT License
36 stars 14 forks source link

Errors when trying to use #13

Closed mgreer closed 7 years ago

mgreer commented 7 years ago

I'm trying to use this in an express app, node v6.x, but always get the following when bundling with webpack:

ERROR in ./~/async-hook/index.js
    Module parse failed: /Users/mgreer/clones/tappestry-web/node_modules/async-hook/index.js 'return' outside of function (11:4)
    You may need an appropriate loader to handle this file type.
    |   if (global._asyncHook.version === require('./package.json').version) {
    |     module.exports = global._asyncHook;
    |     return;
    |   }
    |   // The version don't match, this is really bad. Lets just throw
     @ ./~/cls-hooked/context.js 6:18-39
     @ ./src/Router.js
     @ ./src/10.js

    ERROR in vendor-34072c54a4422fb9817a.min.js from UglifyJs
    SyntaxError: Unexpected token name «key», expected punc «;» [vendor-34072c54a4422fb9817a.min.js:7562,9]

In truth, trying to use cls-hooked, which requires this.

AndreasMadsen commented 7 years ago

Even if I fixed the "SyntaxError" this module won't work in the browser.