Closed domderen closed 9 years ago
Ah sorry, that's annoying, I thought I'd fixed that for good in 0.6.32 (it was introduced in 0.6.31, and was caused by cyclical dependencies on the entry module - does that sound related in any way?). Is there any way you could share the code so I can try and reproduce/debug it? Failing that, inserting the following line...
if ( !imported ) console.log( x );
at 765
in dist/esperanto.js
(immediately before the bug) might yield some useful info.
Hi,
Cyclic dependencies don't sound familiar for my project. It is really small repository, with only 4 modules (files), and none have cyclic dependencies.
Unfortunately at this point I can't share the codebase with you, but I added the log line to esperanto.js
and this is the full log output I got:
> gulp build
[14:30:31] Using gulpfile c:\Users\Dominik\Documents\GitHub\london-cribs\gulpfile.js
[14:30:31] Starting 'lint-src'...
[14:30:32] Starting 'clean'...
[14:30:32] Finished 'clean' after 5.51 ms
[14:30:33] Finished 'lint-src' after 1.43 s
[14:30:33] Starting 'build'...
{ module: null,
node:
{ start: 0,
specifiers: [ [Object] ],
source:
{ start: 20,
value: 'bluebird',
raw: '\'bluebird\'',
type: 'Literal',
end: 30 },
type: 'ImportDeclaration',
end: 31,
_skip: true },
start: 0,
end: 31,
passthrough: false,
path: 'bluebird',
specifiers: [ { isDefault: true, name: 'default', as: 'Promise' } ],
isDefault: true,
as: 'Promise',
next: 33 }
[14:30:33] 'build' errored after 31 ms
[14:30:33] TypeError: Cannot read property 'isExternal' of null
at c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:765:17
at Array.forEach (native)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:762:15)
at c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:776:4
at Array.forEach (native)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:762:15)
at sortModules (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:782:2)
at c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:1640:15
at lib$es6$promise$$internal$$tryCatch (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\node_modules\sander\node_modules\es6-promise\dist\es6-promise.js:319:16)
at lib$es6$promise$$internal$$invokeCallback (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\node_modules\sander\node_modules\es6-promise\dist\es6-promise.js:331:17)
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "node" "c:\\Users\\Dominik\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dist"
npm ERR! node v0.10.35
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! london-cribs@0.1.0 dist: `gulp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the london-cribs@0.1.0 dist script 'gulp build'.
npm ERR! This is most likely a problem with the london-cribs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp build
npm ERR! You can get their info via:
npm ERR! npm owner ls london-cribs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\Users\Dominik\Documents\GitHub\london-cribs\npm-debug.log
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "c:\\Program Files (x86)\\nodejs\\node.exe" "c:\\Users\\Dominik\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.10.35
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! london-cribs@0.1.0 prepublish: `npm run dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the london-cribs@0.1.0 prepublish script 'npm run dist'.
npm ERR! This is most likely a problem with the london-cribs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run dist
npm ERR! You can get their info via:
npm ERR! npm owner ls london-cribs
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! c:\Users\Dominik\Documents\GitHub\london-cribs\npm-debug.log
Thanks, that helps - I've got a reproduction and fix locally, should have this closed shortly
Fixed (hopefully! let me know if you still have problems) in 0.6.33. Thanks for raising it
Hey,
Thanks for the quick fix, the issue is resolved in version 0.6.33.
One more question though, when I was playing around with the code, esperanto crushed on this particular code:
export default {
mongoHost: process.env.MONGO_PORT_27017_TCP_ADDR || '0.0.0.0',
mongoDbUrl: `mongodb://a:b@${this.mongoHost}:27017`
};
with stack trace:
[20:14:03] Error: `this` at the top level is undefined
at Object.walk.enter (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:214:13)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:56:9)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:74:5)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:79:4)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:74:5)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:79:4)
at visit (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:74:5)
at walk (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:36:2)
at annotateAst (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:156:2)
at getModule (c:\Users\Dominik\Documents\GitHub\london-cribs\node_modules\esperanto\dist\esperanto.js:1563:3)
Is that invalid JS? If so why? I would expect this code to work.
Thanks in advance.
See #43 and #151 for previous discussion - it's not invalid JS, but it would cause an error at runtime, because this
is undefined
at the top level of an ES6 module (reference here). Rather than wait for it to blow up at runtime, esperanto throws an error at parse time. (The message could possibly be a bit more descriptive...)
Using global.mongoHost
instead of this.mongoHost
should work.
Achh this makes sense now, thanks for the lesson ;) I wonder why eslint didn't catch that one... Maybe there should be some validation for this implemented there.
Hi,
When my application updated to then newest version of your package i started seeing following error in my build process:
my usage of esperanto limits to my gulpfile and looks like this:
Everything works fine on version 0.6.30.