Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working - MVC project #10

Open
fabr2004 opened this issue Jan 12, 2024 · 0 comments
Open

Not working - MVC project #10

fabr2004 opened this issue Jan 12, 2024 · 0 comments

Comments

@fabr2004
Copy link

I couldn't make this work.
Please advise on what to do.

I have the old "cleave.js" in my MVC project, together with "jquery-3.7.1", which is set at BundleConfig.cs file:

        var jqueryCdnPath = "https://code.jquery.com/jquery-3.7.1.min.js";
        bundles.Add(new ScriptBundle("~/bundles/jquery", jqueryCdnPath).Include(
                    "~/Scripts/plugin/jquery.js"
        ));

        var cleaveCdnPath = "https://cdnjs.cloudflare.com/ajax/libs/cleave.js/1.6.0/cleave.min.js";
        bundles.Add(new ScriptBundle("~/bundles/cleavejs", cleaveCdnPath).Include(
                    "~/Scripts/plugin/cleavejs"
        ));

To start using the new "cleave-zen" I've created a new line at BundleConfig.cs file:

        var cleaveZenCdnPath = "https://cdn.jsdelivr.net/npm/[email protected]/dist/cleave-zen.min.js";
        bundles.Add(new ScriptBundle("~/bundles/cleave-zen", cleaveZenCdnPath).Include(
                    "~/Scripts/plugin/cleave-zen"
        ));

At my view page, I have this section:

        section scripts{
            @Scripts.Render("~/bundles/cleave-zen")
            @Scripts.Render("~/bundles/SamplePage")
        }

At SamplePage.js I've added import { formatGeneral } from 'cleave-zen'; at the first line. This caused this error at browser console:

        Uncaught ReferenceError: exports is not defined at index.ts:156:1
        Uncaught SyntaxError: Cannot use import statement outside a module (SamplePage.js:1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant