jQuery, now using ECMAScript module syntax

A nice commit migrating away from AMD Modules to ECMAScript modules recently landed in the jQuery repo. Once published as a new release, you’ll be able to actually import $ using the modern ES module syntax:

import $ from "jquery";
$('#message').text('Hi from jQuery!');

Handy if you’re modernizing a legacy project that still uses jQuery.

💡 Up until now I’ve been either including jQuery separately or have been relying on webpack-merge-and-include-globally to include jQuery in my Webpack build.

Published by Bramus!

Bramus is a Freelance Web Developer from Belgium. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.