Anonymous

Mod Creation/Essentials: Difference between revisions

From Melvor Idle
Line 54: Line 54:
''This property is '''required''' only if the <code>"setup"</code> property is not present in the manifest.''
''This property is '''required''' only if the <code>"setup"</code> property is not present in the manifest.''


This value accepts either a single path or an array of paths to resources to load. These resources are loaded in the order of the array, after the <code>"setup"</code> resource has been run. Valid resources to be loaded through this property are JavaScript script files (<code>.js</code>), JavaScript module files (<code>.mjs</code>), CSS stylesheets (<code>.css</code>), and HTML files containing templates (<code>.html</code>). However, unless your mod is very simple, the recommended approach to loading JavaScript resources (<code>.js</code> or <code>.mjs</code>) is through code in your mod's entry-point (<code>"setup"</code>).
This value accepts either a single path or an array of paths to resources to load. These resources are loaded in the order of the array, after the <code>"setup"</code> resource has been run. Valid resources to be loaded through this property are JavaScript script files (<code>.js</code>), JavaScript module files (<code>.mjs</code>), CSS stylesheets (<code>.css</code>), JSON files containing game data packages (<code>.json</code>), and HTML files containing templates (<code>.html</code>). However, unless your mod is very simple, the recommended approach to loading JavaScript resources (<code>.js</code> or <code>.mjs</code>) is through code in your mod's entry-point (<code>"setup"</code>).


It's also important to note that while <code>.js</code> is considered a valid extension for JavaScript module files for the "setup" property, modules loaded through "load" must end with <code>.mjs</code> or they will be treated as regular script files.
It's also important to note that while <code>.js</code> is considered a valid extension for JavaScript module files for the "setup" property, modules loaded through "load" must end with <code>.mjs</code> or they will be treated as regular script files.
91

edits