I am getting this message: Uncaught Error: Module name "core" has not been loaded yet for context: _. Use require([])
I have looked at How to use jquery ui with requireJS and knockout-sortable? and How do I use jquery ui with requirejs.
I had a shim like this:
// Note that my paths are set so jqueryui points to right place
'jqueryui/core': ['jquery'],
'jqueryui/widget': ['jqueryui/core'],
'jqueryui/position': ['jqueryui/widget'],
'jqueryui/menu': ['jqueryui/position'],
'jqueryui/autocomplete': [
'jqueryui/core',
'jqueryui/widget',
'jqueryui/position',
'jqueryui/menu'
]
I tried taking away the shim because it's supposed to be AMD. I also tried the export of $
for kicks from the other link. All permutations complain about the line require('./core')
.
I understand the error because I never required core
before this point, but I have the shim. But also the shim probably isn't playing nice with the relative portion.
Update with more info
My actual markup is like this on load:
<script type="text/javascript" src="/assets/node_modules/requirejs/require.js"></script>
<script type="text/javascript" src="/assets/node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/assets/js/requireconfig.js"></script>
<script type="text/javascript" src="/assets/js/problemfile.js"></script>
The problem file then does:
require(['jqueryui/autocomplete'], function(f) { ... });
However the syntax inside core.js
is require('./core')
.
Since Bower is dead/dying I am using npm to install the dependencies directly, so I believe jquery-ui assumes that I'd be doing require on the server rather than on client using requirejs. I see the bits about browserify, but that won't apply to me I believe since my app is PHP/JS not node on the backend.
As mentioned in comment below, I don't believe this is a dupe question since it has to deal with jquery-ui package specifically, rather than a wrong require call in my own written code.