ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
utils.js not importing - Cannot use import statement outside a module
Title:
B
I
{code}
?
I'm not sure what happened, but now when I run any of my projects in Visual Studio, I'm seeing the error "Cannot use import statement outside a module" and then subsequent errors about utils not being defined. I haven't changed my _Layout.cshtml page for these projects since the last time they worked. What could be wrong that's not allowing utils.js to be loaded? This is the order of the imports in the _Layout page: <script src="@Url.Content("~/Scripts/AwesomeMvc.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/awem.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/utils.js")" type="text/javascript"></script> @Html.Awe().Init()
Save Changes
Cancel
Sean Davidson
asked at 17 Aug 2021
there are `import` statements at the beginning of utils.js but they are commented out ( `//` ), make sure you haven't uncommented them
at 17 Aug 2021
Omu
They're not commented out.
at 17 Aug 2021
Sean Davidson
they are commented out when you download the files from us
at 17 Aug 2021
Omu
I downloaded a fresh copy of the code and used that version of utils.js in my project. I made sure to comment out all 4 of the import lines. Not sure if it matters, but the version of utils.js I did have in my working project must have been old as it didn't have the import statements. Would that mean that the imports would have happened somewhere else? Sean
at 17 Aug 2021
Sean Davidson
you need to use all files of the same version, you should be downloading from here: https://www.aspnetawesome.com/Profile/MyPurchases
at 18 Aug 2021
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK