Uncaught SyntaxError: Unexpected token < in RequireJS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Uncaught SyntaxError: Unexpected token < in RequireJS

abangkis
Hi guys, I'm in the process of migrating my application from Tap 5.3.8 to
Tap 5.4-beta-26.

I have a simple Index.tml, Index.java and my_test.js files. But whenever i
run the app the Chrome console keep showing an error

Loading 0 libraries
console.js:104 Executing 1 inits
my_test.js:1 Uncaught SyntaxError: Unexpected token <
console.js:104 Loaded module my_test.js
console.js:104 All inits executed
require.js:1895 Resource interpreted as Script but transferred with MIME
type text/html: "http://localhost:8080/Tap54/my_test.js".

Here's my index.tml

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
xmlns:p="tapestry:parameter"
lang="en">
<body>
 <h1>Hello</h1>
 </body>
</html>

Index.java

@Import(module = "my_test.js")
public class Index {

}

And my_test.js

define(["jquery", "t5/core/console", "bootstrap"], function($, console) {
  return function(params) {
    console.warn("jQuery version: " + $().jquery);
  };
});

My project structure is like this :
src
  + net.mreunionlabs.tap54
     + pages
        + Index.java
WebContent
   + META-INF
      + modules
         + my_test.js
   + WEB-INF


I tried putting the modules under WEB-INF/classes/META-INF/modules but it
still shows the same error.

Any suggestion?

Thanks

--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|

Re: Uncaught SyntaxError: Unexpected token < in RequireJS

abangkis
Okay i found out the problem, after sending the email. The module name
should only be "my_test" not "my_test.js" just realized it after reading
the require js page. And the modules is put under
WEB-INF/classes/META-INF/modules
 but it ask for bootstrap.js

GET http://localhost:8080/Tap54/modules.gz/bootstrap.js
console.js:104 RequireJS error: scripterror: Script error for: bootstrap
http://requirejs.org/docs/errors.html#scripterror, modules bootstrap

So it didn't detect tapestry bootstrap.js file. I erase the bootstrap param
from define and it works.

Thanks.

On Sat, Feb 7, 2015 at 9:24 AM, abangkis <[hidden email]> wrote:

> Hi guys, I'm in the process of migrating my application from Tap 5.3.8 to
> Tap 5.4-beta-26.
>
> I have a simple Index.tml, Index.java and my_test.js files. But whenever i
> run the app the Chrome console keep showing an error
>
> Loading 0 libraries
> console.js:104 Executing 1 inits
> my_test.js:1 Uncaught SyntaxError: Unexpected token <
> console.js:104 Loaded module my_test.js
> console.js:104 All inits executed
> require.js:1895 Resource interpreted as Script but transferred with MIME
> type text/html: "http://localhost:8080/Tap54/my_test.js".
>
> Here's my index.tml
>
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
> xmlns:p="tapestry:parameter"
> lang="en">
> <body>
>  <h1>Hello</h1>
>  </body>
> </html>
>
> Index.java
>
> @Import(module = "my_test.js")
> public class Index {
>
> }
>
> And my_test.js
>
> define(["jquery", "t5/core/console", "bootstrap"], function($, console) {
>   return function(params) {
>     console.warn("jQuery version: " + $().jquery);
>   };
> });
>
> My project structure is like this :
> src
>   + net.mreunionlabs.tap54
>      + pages
>         + Index.java
> WebContent
>    + META-INF
>       + modules
>          + my_test.js
>    + WEB-INF
>
>
> I tried putting the modules under WEB-INF/classes/META-INF/modules but it
> still shows the same error.
>
> Any suggestion?
>
> Thanks
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771
>



--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771
Reply | Threaded
Open this post in threaded view
|

Re: Uncaught SyntaxError: Unexpected token < in RequireJS

JumpStart
These might help you get up to speed faster:

        http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/javascript
        http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/reusable
        http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust
        http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/mixin

HTH,

Geoff

On 7 Feb 2015, at 1:47 pm, abangkis <[hidden email]> wrote:

> Okay i found out the problem, after sending the email. The module name
> should only be "my_test" not "my_test.js" just realized it after reading
> the require js page. And the modules is put under
> WEB-INF/classes/META-INF/modules
> but it ask for bootstrap.js
>
> GET http://localhost:8080/Tap54/modules.gz/bootstrap.js
> console.js:104 RequireJS error: scripterror: Script error for: bootstrap
> http://requirejs.org/docs/errors.html#scripterror, modules bootstrap
>
> So it didn't detect tapestry bootstrap.js file. I erase the bootstrap param
> from define and it works.
>
> Thanks.
>
> On Sat, Feb 7, 2015 at 9:24 AM, abangkis <[hidden email]> wrote:
>
>> Hi guys, I'm in the process of migrating my application from Tap 5.3.8 to
>> Tap 5.4-beta-26.
>>
>> I have a simple Index.tml, Index.java and my_test.js files. But whenever i
>> run the app the Chrome console keep showing an error
>>
>> Loading 0 libraries
>> console.js:104 Executing 1 inits
>> my_test.js:1 Uncaught SyntaxError: Unexpected token <
>> console.js:104 Loaded module my_test.js
>> console.js:104 All inits executed
>> require.js:1895 Resource interpreted as Script but transferred with MIME
>> type text/html: "http://localhost:8080/Tap54/my_test.js".
>>
>> Here's my index.tml
>>
>> <!DOCTYPE html>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
>> xmlns:p="tapestry:parameter"
>> lang="en">
>> <body>
>> <h1>Hello</h1>
>> </body>
>> </html>
>>
>> Index.java
>>
>> @Import(module = "my_test.js")
>> public class Index {
>>
>> }
>>
>> And my_test.js
>>
>> define(["jquery", "t5/core/console", "bootstrap"], function($, console) {
>>  return function(params) {
>>    console.warn("jQuery version: " + $().jquery);
>>  };
>> });
>>
>> My project structure is like this :
>> src
>>  + net.mreunionlabs.tap54
>>     + pages
>>        + Index.java
>> WebContent
>>   + META-INF
>>      + modules
>>         + my_test.js
>>   + WEB-INF
>>
>>
>> I tried putting the modules under WEB-INF/classes/META-INF/modules but it
>> still shows the same error.
>>
>> Any suggestion?
>>
>> Thanks
>>
>> --
>> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
>> twitter : @mreunionlabs @abangkis
>> page : https://plus.google.com/104168782385184990771
>>
>
>
>
> --
> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> twitter : @mreunionlabs @abangkis
> page : https://plus.google.com/104168782385184990771


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Uncaught SyntaxError: Unexpected token < in RequireJS

abangkis
Hi Geoff thanks for the help. Yes, I've always check for jumpstart first if
i run into trouble. It has been invaluable :)

On Sun, Feb 8, 2015 at 6:02 PM, Geoff Callender <
[hidden email]> wrote:

> These might help you get up to speed faster:
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/javascript
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/reusable
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/robust
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/javascript/mixin
>
> HTH,
>
> Geoff
>
> On 7 Feb 2015, at 1:47 pm, abangkis <[hidden email]> wrote:
>
> > Okay i found out the problem, after sending the email. The module name
> > should only be "my_test" not "my_test.js" just realized it after reading
> > the require js page. And the modules is put under
> > WEB-INF/classes/META-INF/modules
> > but it ask for bootstrap.js
> >
> > GET http://localhost:8080/Tap54/modules.gz/bootstrap.js
> > console.js:104 RequireJS error: scripterror: Script error for: bootstrap
> > http://requirejs.org/docs/errors.html#scripterror, modules bootstrap
> >
> > So it didn't detect tapestry bootstrap.js file. I erase the bootstrap
> param
> > from define and it works.
> >
> > Thanks.
> >
> > On Sat, Feb 7, 2015 at 9:24 AM, abangkis <[hidden email]> wrote:
> >
> >> Hi guys, I'm in the process of migrating my application from Tap 5.3.8
> to
> >> Tap 5.4-beta-26.
> >>
> >> I have a simple Index.tml, Index.java and my_test.js files. But
> whenever i
> >> run the app the Chrome console keep showing an error
> >>
> >> Loading 0 libraries
> >> console.js:104 Executing 1 inits
> >> my_test.js:1 Uncaught SyntaxError: Unexpected token <
> >> console.js:104 Loaded module my_test.js
> >> console.js:104 All inits executed
> >> require.js:1895 Resource interpreted as Script but transferred with MIME
> >> type text/html: "http://localhost:8080/Tap54/my_test.js".
> >>
> >> Here's my index.tml
> >>
> >> <!DOCTYPE html>
> >> <html xmlns="http://www.w3.org/1999/xhtml"
> >> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
> >> xmlns:p="tapestry:parameter"
> >> lang="en">
> >> <body>
> >> <h1>Hello</h1>
> >> </body>
> >> </html>
> >>
> >> Index.java
> >>
> >> @Import(module = "my_test.js")
> >> public class Index {
> >>
> >> }
> >>
> >> And my_test.js
> >>
> >> define(["jquery", "t5/core/console", "bootstrap"], function($, console)
> {
> >>  return function(params) {
> >>    console.warn("jQuery version: " + $().jquery);
> >>  };
> >> });
> >>
> >> My project structure is like this :
> >> src
> >>  + net.mreunionlabs.tap54
> >>     + pages
> >>        + Index.java
> >> WebContent
> >>   + META-INF
> >>      + modules
> >>         + my_test.js
> >>   + WEB-INF
> >>
> >>
> >> I tried putting the modules under WEB-INF/classes/META-INF/modules but
> it
> >> still shows the same error.
> >>
> >> Any suggestion?
> >>
> >> Thanks
> >>
> >> --
> >> http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> >> twitter : @mreunionlabs @abangkis
> >> page : https://plus.google.com/104168782385184990771
> >>
> >
> >
> >
> > --
> > http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
> > twitter : @mreunionlabs @abangkis
> > page : https://plus.google.com/104168782385184990771
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
http://www.mreunionlabs.net/ <http://www.mreunion-labs.net/>
twitter : @mreunionlabs @abangkis
page : https://plus.google.com/104168782385184990771