Require.js problem
-
Hello guys.
I am creating a theme based on a design made by others. And i need to use require.js
I have loaded the require.js file like this :
wp_enqueue_script( 'require.js', get_template_directory_uri() . '/js/require.js', array('jquery') );and then load my initial js file like so:
wp_enqueue_script( 'my_script.js', get_template_directory_uri() . '/js/home.js', array('jquery') );My home.js only have this:
var global = require('includes/global.js');The result is
Uncaught Error: Module name “includes/global.js” has not been loaded yet for context: _. Use require([])
My question is how can I load this global.js? Maybe I am doing lots of things wrong but I am still learning.
Any help would be greatly appreciated. Thx
The topic ‘Require.js problem’ is closed to new replies.