jquery-ui和webpack,如何将其管理到模块中?

jquery-ui Webpack

泡芙

2020-03-23

知道如何处理吗?我的意思是jquery-ui似乎不是amd,而且我不知道该如何管理,知道吗?

第2940篇《jquery-ui和webpack,如何将其管理到模块中?》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点

1个回答
神乐 2020.03.23

jquery-ui-dist并且jquery-ui-bundle似乎不由jquery-ui团队维护。在jquery-ui jquery-uiv1.12 之后,可以将npm中的官方包与webpack一起使用。

通过更新package.json将jquery-ui更新到1.12 npm install

然后,您可以require像这样每个小部件。

require("jquery-ui/ui/widgets/autocomplete");
require("jquery-ui/ui/widgets/draggable");

If you have used require("jquery-ui") before you need to replace it with separate imports for each widget. I think the new way is better because it will bundle only the code for the widget we need to use.

See documentation on using the 1.12 official npm package.

问题类别

JavaScript Ckeditor Python Webpack TypeScript Vue.js React.js ExpressJS KoaJS CSS Node.js HTML Django 单元测试 PHP Asp.net jQuery Bootstrap IOS Android