Migrating to ES6 syntax for an app using a library built on jQuery can lead to questions about importing jQuery in the new syntax.
1. Import from the node_modules Directory
import * as stylesheet from '../assets/styles/app.scss';<br>import {$, jQuery} from 'jquery'; // Import from node_modules<br>import * as jquery3 from '../dist/scripts/jquery.min';</p> <p>console.log($('my-app'));<br>
2. Export for Other Scripts
window.$ = $;<br>window.jQuery = jQuery;<br>
The above is the detailed content of How to Import jQuery in ES6 Syntax?. For more information, please follow other related articles on the PHP Chinese website!