Update JavaScript templates to use define calls