Thank you so much for your response. I will try tonight and give us some
feedback. I checked that the mixin for autocomplete is failing in
production mode for the same reason. It could be a problem if we import
libraries with no "use strict" restrictions.

Best regards

Carlos Montero

El mar., 14 abr. 2020 a las 18:08, Cezary Biernacki (<cezary...@gmail.com>)
escribió:

> Hi Carlos,
> Tapestry in the production mode minifies all JavaScript. It seems that
> minification in T5.5 adds "'use strict';" pragma to minified files. "'use
> strict';" instructs the browser to fail if anything is wrong with your
> code, instead of trying quietly to fix problems. In your code "init =
> *function*(){"  refers to undeclared variable "init". Non-strict JavaScript
> automatically defines such variable, but in the strict mode it fails with
> the error: "init is not defined". All you need is to declare "init",
> e.g.: "var init = function(){".
>
> "use strict" is generally a good idea, because it ensures that all browser
> will execute your code in the same way, and any typos will not be silently
> ignored. I recommend adding line
> 'use strict';
> at the beginning of your .js file, so the code will work the same way in
> the development and and the production mode.
>
> Best regards,
> Cezary
>
>
>
>
> On Mon, Apr 13, 2020 at 8:45 PM Carlos Montero Canabal <
> carlosmonterocana...@gmail.com> wrote:
>
> > Hi Tapestry users!
> >
> > I'm deploying my first 5.5.0 app into production... and I checked that my
> > modules js doesnt work with production mode = true.
> >
> > Example:
> >
> > article.js:
> >
> > define(["jquery", "prism"], *function*($, Prism) {
> >
> > init = *function*(){
> >
> > Prism && Prism.hasOwnProperty('default') ? Prism['default'] : Prism;
> >
> > }
> >
> > *return*{
> >
> > init : init
> >
> > }
> >
> > });
> >
> >
> > ArticlePage.java
> >
> >
> > javaScriptSupport.require("article").invoke("init");
> >
> >
> > NOTE: It works fine with production mode = false.
> >
> >
> > The error is "RequireJS error: define: init is not defined, modules
> > article".
> >
> >
> > However, if I rewrite my module as below:
> >
> >
> > define(["jquery", "prism"], *function*($, Prism) {
> >
> > *return* *function*(){
> >
> > Prism && Prism.hasOwnProperty('default') ? Prism['default'] : Prism;
> >
> > }
> >
> > });
> >
> >
> > And my javacode to:
> >
> >
> > javaScriptSupport.require("article");
> >
> >
> > It works fine. But I want to define multiple functions inside the same
> > module.
> >
> >
> > In my apps in Tapestry 5.4.X I always use the modules as I wrote before.
> >
> >
> > Any suggestion?
> >
> >
> > For other hand, I think there is a missaligment on tapestry-webresources:
> >
> >
> > [image: image.png]
> >
> > In my project, with maven 3.6.3 protobuf-java is 2.5.0 from less4j but
> > webapp breaks when it inits the closure compiler. I had to fix writing
> the
> > version in my pom to 3.0.2.
> >
> > Best regards
> >
> > Carlos Montero
> >
>

Reply via email to