-
-
Save aaitken/9149010 to your computer and use it in GitHub Desktop.
===scripts/test/tester.js=== | |
--- | |
browserify: true | |
--- | |
module.exports = function(){ | |
console.log('I am tester!'); | |
}; | |
===scripts/app.js=== | |
--- | |
browserify: true | |
--- | |
var tester = require('./test/tester'); | |
tester(); |
aaitken
commented
Feb 22, 2014
- Docpad browserifydoc plugin applies the browserify wrapper and bundles the 2 files.
- app.js's invocation of tester, however, returns error: object is not a function.
- no matter the configs I play with, tester never exposes anything other than an empty object.
Try this:
===scripts/test/tester.js===
module.exports = function(){
console.log('I am tester!');
};
===scripts/app.js===
--- cson
browserify: require: ['./test/tester']
---
var tester = require('./test/tester');
tester();
Thanks. For some reason, though, when I put the require in the meta it can't find the module:
error: Something went wrong with the action
error: An error occured:
Error: Cannot find module '0' from '/Users/alex.aitken/Projects/alex-ai-browserify'
at /Users/alex.aitken/Projects/alex-ai-browserify/node_modules/docpad-plugin-browserifydocs/node_modules/browserify/node_modules/resolve/lib/async.js:44:17
at process (/Users/alex.aitken/Projects/alex-ai-browserify/node_modules/docpad-plugin-browserifydocs/node_modules/browserify/node_modules/resolve/lib/async.js:110:43)
at /Users/alex.aitken/Projects/alex-ai-browserify/node_modules/docpad-plugin-browserifydocs/node_modules/browserify/node_modules/resolve/lib/async.js:119:21
at load (/Users/alex.aitken/Projects/alex-ai-browserify/node_modules/docpad-plugin-browserifydocs/node_modules/browserify/node_modules/resolve/lib/async.js:54:43)
at /Users/alex.aitken/Projects/alex-ai-browserify/node_modules/docpad-plugin-browserifydocs/node_modules/browserify/node_modules/resolve/lib/async.js:60:22
at /Users/alex.aitken/Projects/alex-ai-browserify/node_modules/docpad-plugin-browserifydocs/node_modules/browserify/node_modules/resolve/lib/async.js:16:47
at Object.oncomplete (fs.js:107:15)