Friday, September 15, 2017

webpack and Jquery-ui

Here is the way to integrate jquery-ui in webpack project

npm install jquery-ui-dist --save
webpack.config.js

resolve: {
    alias: {
        'jquery-ui': 'jquery-ui-dist/jquery-ui.js'
    }
},
...
plugins: [
    new webpack.ProvidePlugin({
        'jQuery': 'jquery',
        '$': 'jquery',
        'global.jQuery': 'jquery'
    })
],
In the .js file, load the module
require('jquery-ui');  //or import 'jquery-ui'
Reference
https://stackoverflow.com/questions/33998262/jquery-ui-and-webpack-how-to-manage-it-into-module
https://github.com/hairinwind/myVue/blob/master/build/webpack.base.conf.js
https://github.com/hairinwind/myVue/blob/master/src/components/JqueryUI.vue

No comments:

Post a Comment