I added some js files which were exported from Adobe Muse to my wwwroot/js folder. However, when I check the console, it doesn't look like these folders can be found.
I am calling the scripts using:
<script src="~/js/require.js?crc=4157109226" type="text/javascript" async data-main="~/js/museconfig.js?crc=4153641093" onload="if (requirejs) requirejs.onError = function(requireType, requireModule) { if (requireType && requireType.toString && requireType.toString().indexOf && 0 <= requireType.toString().indexOf('#scripterror')) window.Muse.assets.check(); }" onerror="window.Muse.assets.check();"></script>
The errors I'm getting are below:
And finally I have my folders set up as follows
data-main
attribute is read by requirejs
and not by Razor
engine. That is why requirejs
being a JavaScript library will not be able to resolve ~
in the path. Use Url.Content
for that, like below.
data-main="@Url.Content("~/js/museconfig.js")"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.