Hello,
We have an ASP.NET Core app (without angular, react or vue).
We are pulling the file https://npm.daypilot.org/daypilot-pro-javascript/***/2023.1.5488.tar.gz to be used in our local npm repo.
in our package.json we have the following (other dependencies were removed for this post):
{
"version": "1.0.0",
"name": "asp.net",
"private": true,
"dependencies": {
"daypilot-pro-javascript": "^2023.1.5488"
}
}
in our bundleconfig.json we have this configuration:
{
"outputFileName": "wwwroot/js/bundle-daypilot.js",
"inputFiles": [
"node_modules/daypilot-pro-javascript/daypilot-javascript.min.js"
]
},
in our Index.xshtml view we are using this line to load the JavaScript:
<script src="~/js/bundle-daypilot.js" asp-append-version="true"></script>
but on loading the page we get a javascript error:
bundle-daypilot.js?v=GvIg2_avHtwOVk9WM8w3DdafmP7bc-buTMWg2sVbWq0:37 Uncaught ReferenceError: module is not defined
at bundle-daypilot.js?v=GvIg2_avHtwOVk9WM8w3DdafmP7bc-buTMWg2sVbWq0:37:13
at bundle-daypilot.js?v=GvIg2_avHtwOVk9WM8w3DdafmP7bc-buTMWg2sVbWq0:37:48
If we compare the file that we manually download and the one that we get by npm link,
the script from npm has this line extra:
!function(){module.exports={DayPilot:DayPilot}}();
Question: How do we use the npm package in our project if we pull the javascript from npm?