It seems requiring a JSON file is not a working case of the require shim.
It's called with a relative path, not absolute like explained in your README.
$ webmake index.js dist/tld.js
Error: Module '/Users/oncletom/workspace/tld.js/src/rules.json' not found, as required in '/Users/oncletom/workspace/tld.js/index.js'
at Function.exports._onresolve.then (/usr/local/lib/node_modules/webmake/node_modules/deferred/lib/_ext.js:61:14)
at Object.Deferred.resolve (/usr/local/lib/node_modules/webmake/node_modules/deferred/lib/deferred.js:118:26)
at dirExists (/usr/local/lib/node_modules/webmake/lib/parser.js:37:7)
at Object.oncomplete (fs.js:297:15)
$ ls src/
@oncletom json files support was added into Node with v0.6 version, and unfortunately Webmake doesn't support them yet, but it's scheduled for next major update: v0.4
Oh that's nice to know :-)
So far, I deal with concat task to wrap my unique JSON file as a module.
But it causes quite much supplementary work just to make something working… automatically.
It will definitely be added. I'll leave this issue open until we have it with v0.4
I also suggest to support require for YAML files (*.yml and *.yaml). That works exactly as with json, after you do require(js-yaml); in your code.
With new version it would be possible to configure handling of any specific file format. So even if support for *.yml won't be provided out of a box, it'll be straightforward to configure such.
Final configuration providing support for JSON
Million thanks to @puzrin for sponsoring work on Webmake, and making
this feature available sooner than it was initially planned :)
I've just published version of Webmake (v0.3.16) that provides support for JSON files.
It's highly recommended to upgrade, as it also brings other improvements.
Support for YAML files is possible via webmake-yaml extension
Thanks @puzrin for pushing work on that forward! :)
@oncletom please reopen if you have any issues.
I'll do; thank you!