Add AMD support

Export an AMD module if possible.