railsware / js-routes

Brings Rails named routes to javascript
http://railsware.github.io/js-routes/
MIT License
1.61k stars 151 forks source link

module_type: nil causes "NIL is not supported by runtime" #292

Closed kyrofa closed 2 years ago

kyrofa commented 2 years ago

The README states:

You can manipulate the generated helper manually by injecting ruby into javascript:

export const routes = <%= JsRoutes.generate(module_type: nil, namespace: nil) %>

However, in practice, for me on version 2.1.2 that leads to an uncaught exception: "NIL is not supported by runtime". Is this bit of the README out of date? Is there still a way to do this?

bogdan commented 2 years ago

Yes, it should be supported. Can you give me a full backtrace?

bogdan commented 2 years ago

I've tried to fix the issue, but I am not 100% sure why it is there in the first place. Can you try the current master and see if it helps?

bogdan commented 2 years ago

No followup, closing.

khiemb commented 2 years ago

I'm experiencing this same error, with version 2.2.2

here's the stack trace

routes.js.erb:475 Uncaught Error: NIL is not supported by runtime
    at UtilsClass.ensure_module_supported (routes.js.erb:475:1)
    at UtilsClass.define_module (routes.js.erb:479:1)
    at routes.js.erb:1397:1
    at Module.<anonymous> (routes.js.erb:1399:1)
    at Module../app/javascript/routes.js.erb (routes.js.erb:1401:1)
    at __webpack_require__ (bootstrap:79:1)
    at Module../app/javascript/packs/application.js (application.js:1:1)
    at __webpack_require__ (bootstrap:79:1)
    at Object.1 (.*$:292:1)
    at __webpack_require__ (bootstrap:79:1)