johnsoftek / plugin-jade

Jade loader plugin for jspm
MIT License
13 stars 5 forks source link

Uncaught (in promise) Error: (SystemJS) Cannot read property '_handle' of undefined #21

Closed zakdances closed 8 years ago

zakdances commented 8 years ago
Uncaught (in promise) Error: (SystemJS) Cannot read property '_handle' of undefined
    TypeError: Cannot read property '_handle' of undefined
        at eval (http://localhost:3000/jspm_packages/npm/uglify-js@2.7.0/tools/node.js:3:15)
        at Array.forEach (native)
        at Object.eval (http://localhost:3000/jspm_packages/npm/uglify-js@2.7.0/tools/node.js:2:34)
        at eval (http://localhost:3000/jspm_packages/npm/uglify-js@2.7.0/tools/node.js:263:4)
        at eval (http://localhost:3000/jspm_packages/npm/uglify-js@2.7.0/tools/node.js:264:3)
    Evaluating http://localhost:3000/jspm_packages/npm/uglify-js@2.7.0/tools/node.js
    Evaluating http://localhost:3000/jspm_packages/npm/transformers@2.1.0/lib/transformers.js
    Evaluating http://localhost:3000/jspm_packages/npm/jade@1.11.0/lib/filters.js
    Evaluating http://localhost:3000/jspm_packages/npm/jade@1.11.0/lib/parser.js
    Evaluating http://localhost:3000/jspm_packages/npm/jade@1.11.0/lib/index.js
    Error loading http://localhost:3000/jspm_packages/github/johnsoftek/plugin-jade@1.1.2/jade.js
    Error loading http://localhost:3000/Home/home.jade!http://localhost:3000/jspm_packages/github/johnsoftek/plugin-jade@1.1.2/jade.js as "./home.jade!" from http://localhost:3000/Home/home.component.ts
johnsoftek commented 8 years ago

@zakdances Hmm. Please provide a simple example that produces the error.

zakdances commented 8 years ago

@johnsoftek I couldn't re-create this error. Sorry for wasting your time!

coderfin commented 7 years ago

@zakdances @johnsoftek

Do we know what resolved this issue?

I'm trying to create a JSPM plugin using Pug. I'm running into this same issue (see screenshot below).

screen shot 2017-02-08 at 11 39 02 am

johnsoftek commented 7 years ago

@coderfin Are you trying to include uglify a Javascript file?

coderfin commented 7 years ago

@johnsoftek Yes, it's part of pug/jade

johnsoftek commented 7 years ago

@coderfin pug/jade is written for node.js, so it uses modules and objects that exist in node.js such as fs and the process object. So you need to avoid code that uses those features. For example, plugin-jade replaces the built-in include to bypass the use of fs.

I assume that you are using include name-of-javascript-file.uglify. You could extend the include replacement to recognise .uglify and invoke a browser friendly uglifyjs - or process as plain js.