Why is the javscript requirement of my module not being implemented well?

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

4.4

Why is the javscript requirement of my module not being implemented well?

Hi I try to add pece of javascript with help of the requirement-statement.
After getting error, that my module was not found, I came along with that code.

Requirements::javascript("orderprofilefeature:javascript/order.js");

I get no error anymore but in the html-code this script-tag is added which wont work:

<script type="application/javascript" src="orderprofilefeature:javascript/order.js"></script>

the module path:
vendor/schrattenholz/orderprofilefeature
the path to order.js:
vendor/schrattenholz/orderprofilefeature/javscript/order.js

the expose-statement of the composer-file:

"extra": {
		"expose": [
		  "javascript",
		  "css",
		  "images"
		]
	  },

any help appreciated :slight_smile:

I think you need the full vendor path in the declaration:

Requirements::javascript('schrattenholz/orderprofilefeature:javascript/order.js')

Hi Dorset,
if I do so I get folowing error

Uncaught InvalidArgumentException: Canā€™t find module ā€˜schrattenholz/orderprofilefeatureā€™, the composer.json file may be missing from the modules installation directory

OK, so just to checkā€¦ the composer.json file exists in your module directory? Does it have the name set to match, etc. ?

1 Like

Hej, that was the right link. The File exists but in the name-parameter there was a spelling mistake :wink:

1 Like