hello friends, I’ve been struggling a lot to advance compile my om.next
application that perfectly works in dev
I am using googlemap
externs from cljsjs, if someone has had same issues I would be glad to hear that
@baptiste-from-paris are you using fulcro?
nop, om-next
+ compassus
+ pushy
and bidi
humm, I'm asking because I saw some problems related to the enviroment when compiling fulcro on advanced
it makes me crazy ^^
but might apply for you as well
tell me
you can try compiling and forcing the dev environment to be left out
I'm trying to remember the command
but I guess it's something with "-dev"
@baptiste-from-paris try: lein with-profile -dev cljsbuild once prod
(replace prod
with your production env compilation name, and replace dev as well if you use a different name)
and that’s suppose to build the minified js with my prod profile
dev ?
let's not confuse profile with build ids, hehe
ohhhh lol
you want to build the build id prod
, removing the dev
profile
ok
it's about some dependencies, I don't remember which, but there are some dev dependencies that can break your adv compilation
I remember @tony.kay had to deal with this, I just can't remember which dependencies were the troublesome
it’s working
I can’t believe I spent 5 hours yersterday with this 😢
thanks a lot
nice, glad to hear 🙂
crazy
sorry about the time spent, but that's how we learn 🙂
it’s okay, it’s really not easy to debug advanced code
@wilkerlucio do you know if compiler imports automarically deps.cljs
from cljsjs when you add it to your dependencies ?
@baptiste-from-paris yes it does
ok 🙂
I try out cljs with react material-ui https://github.com/madvas/cljs-react-material-ui-example
class Login extends Component {
static muiName = 'FlatButton';
render() {
return (
<FlatButton {...this.props} label="Login" />
);
}
}
How can we convert static muiName = 'FlatButton'
to om.next defui
?(defui Login ,,,)
(set! (.-muiName Login) "Flatbutton")
thank @sundarj, but it doesn’t work 😞
the set!
does not work?
that is all the static
syntax in js should do, i think
class Foo { static foo = 2 }
is equivalent to class Foo {}; Foo.foo = 2
i believe
maybe, you’re right! I think the macro defui
didn’t create js class Login
. So, the static
syntax doesn’t work
ah
@wilkerlucio turns out it was not a dependency problem
Here is the problem: Om Next has a compiler hack in it. As-in: it actually patches the compiler to work differently. If you have something like tools namespace refresh in any of your source files (e.g. set-refresh-dirs!
), then the Clojure environment may reload the compiler (and undo the compiler hack) before doing the compile. This results in code that fails adv optimization. So, the solution is to use a non-development profile that does not have any files from say user
where such things are done.
I have hope that something will change in the internals of Om Next that will obviate the need for it having a compiler hack, since such a thing is quite fragile. But, for the time being it is best to at least know it is there.