I am using requireJS in my project and want to load survey-core and survey-creator-core.
survey-creator-core has a dependency on survey-core when i checked the js file of survey-creator-core.
I got the survey-core module when i import it in my ts file but survey-creator-core stays undefined.
here is the code
<script type="text/javascript">
var require = {
baseUrl: "/bundles",
paths: {
jquery: "/bundles/jquery",
moment: "/bundles/moment",
bootstrap: "/bundles/bootstrap",
select2: "/bundles/select2",
"knockout" : "/bundles/knockout",
"survey-core": "/bundles/survey-core",
"survey-creator-core": "/bundles/survey-creator-core",
"survey-knockout-ui": "/bundles/survey-knockout-ui",
"survey-creator-knockout": "/bundles/survey-creator-knockout"
},
shim: {
moment: {
deps: ["jquery"]
},
bootstrap: {
deps: ["jquery", "moment"]
},
select2: {
deps: ["jquery"]
},
"survey-creator-core": {
deps: ["survey-core"]
},
"survey-creator-knockout": {
deps: ["survey-creator-core"]
}
},
deps: ["jquery", "moment", "bootstrap"],
urlArgs: "v=@version"
};
</script>
<script src="~/lib/requirejs/require.js" asp-append-version="true"></script>
this is how i use it in one of my cshtml file
@section Scripts {
<script type="text/javascript">
require(["jquery", "bootstrap", "select2"], function () {
require(["survey-core", "survey-creator-core"], function (Survey, SurveyCreator) {
require(["./test"], function (ea) {
var c = new ea.test();
});
});
});
</script>
}
In the above code SurveyCreator is coming as undefined.
Survey is loaded successfully.
1