I am trying to write a library that uses some native JS, but am getting an error 'could not find module Native.MyModuleName' when trying to compile using elm-make. I've cloned the directory structure and stub of the native code from Max New's lazy package (thanks Max!):
https://github.com/maxsnew/lazy/blob/master/src/Native/Lazy.js
I'm guessing I'm just doing something silly. Any help would be greatly appreciated!
Here's what I'm doing:
$ elm-make src/Messages.elm --output=messages.html
Error when searching for modules imported by module 'Messages':
Could not find module 'Native.Messages'
Potential problems could be:
* Misspelled the module name
* Need to add a source directory or new dependency to elm-package.json
Hmm, ok. Here's my elm-package.json:
{
"version": "1.0.0",
"summary": "w00t",
"license": "MIT",
"source-directories": [
"src"
],
"exposed-modules": ["Messages"],
"dependencies": {
"elm-lang/core" : "1.0.0 <= v < 2.0.0",
"Dandandan/Easing" : "1.0.1 <= v < 2.0.0",
"maxsnew/lazy" : "1.0.0 <= v < 2.0.0"
}
}
And here's my directory structure:
src/
Native/
Messages.js
Messages.elm
And here's the relevant content from Messages.elm:
module Messages where
import Native.Messages
-- some stuff
And Messages.js:
Elm.Native.Messages = {};
Elm.Native.Messages.make = function(localRuntime) {
localRuntime.Native = localRuntime.Native || {};
localRuntime.Native.Messages = localRuntime.Native.Messages || {};
if (localRuntime.Native.Messages.values) {
return localRuntime.Native.Messages.values;
}
function blah(oog) {
// some stuff
}
return localRuntime.Native.Messages.values = {
blah: blah
};
};
Could anyone tell me what I'm doing wrong?
Paul :)