duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

Convert Duo.js module to node.js module #465

Closed zooshme closed 9 years ago

zooshme commented 9 years ago

Hi. Is there a way I could require a javascript module compiled by duo.js into a node application on the back end? At the moment when I require it, it is simply an empty object. I have tried installing node-amd-loader but still the same result.

dominicbarnes commented 9 years ago

I have no idea if this will work, but try compiling with --standalone "module.exports":

$ duo --standalone "module.exports" --stdout input.js > output.js

Then you might be able to require it via node:

var foo = require('./output.js');
zooshme commented 9 years ago

Thank you. It works. Is there a way to require the resulted code without writing to a file?

dominicbarnes commented 9 years ago

I doubt it, I'm afraid.