And then the error is thrown right after npm start:
/home/unexpected/work/libertysoil/src/definitions/users.js:125
username: Username }))function _assert(x, type, name) {function message() {return 'Invalid value ' + _tcomb.default.stringify(x) + ' supplied to ' + name + ' (expected a ' + _tcomb.default.getTypeName(type) + ')';}if (_tcomb.default.isType(type)) {if (!type.is(x)) {type(x, [name + ': ' + _tcomb.default.getTypeName(type)]);_tcomb.default.fail(message());}return type(x);}if (!(x instanceof type)) {_tcomb.default.fail(message());}return x;}
^^^^^^^^
SyntaxError: Unexpected token function
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at loader (/home/unexpected/work/libertysoil/node_modules/babel-cli/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/unexpected/work/libertysoil/node_modules/babel-cli/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/unexpected/work/libertysoil/src/definitions/posts.js:24:1)
at Module._compile (module.js:556:32)
at loader (/home/unexpected/work/libertysoil/node_modules/babel-cli/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/home/unexpected/work/libertysoil/node_modules/babel-cli/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
Finally I've found if I remove retainLines: true from babel config, the problem disappears completely. It's surprising because I already use type recursion in my code and it works well without disabling retainLines option:
Hello.
I use
tcomb
(v3.2.15
) andbabel-plugin-tcomb
(v0.3.21
) withbabel-loader
(v6.2.7
).My
babel-loader
's query inwebpack
dev configuration:There's an error during webpack building:
The reason of problem is
My configuration files can be a bit confusing. Let me edit them:
And then the error is thrown right after
npm start
:Finally I've found if I remove
retainLines: true
from babel config, the problem disappears completely. It's surprising because I already use type recursion in my code and it works well without disablingretainLines
option:Could you inspect the problem, please? Is my code correct? If yes, is it possible to fix this specific bug?
Thank you.