Reputation: 202
Doing this:
import $ from 'jquery';
Shows the error
The $ prefix is reserved, and cannot be used for variable and import names svelte(illegal-declaration)
Upvotes: 20
Views: 24342
Reputation: 557
I noticed that if JQuery is already available globally, then you can access it via window.$
instead of just $
and the svelte compiler won't complain.
Upvotes: 14
Reputation: 8478
You can just use import as
syntax:
import * as $j from 'jquery';
Or as anyName
that you can use
Upvotes: 20