jquerysveltesapper

How do I use jQuery in Svelte


Doing this:

import $ from 'jquery';

Shows the error

The $ prefix is reserved, and cannot be used for variable and import names svelte(illegal-declaration)

Solution

  • You can just use import as syntax:

    import * as $j from 'jquery';
    

    Or as anyName that you can use