Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

use jquery in project using NPM

// webpack.config.js
const webpack = require('webpack')

module.exports = {
  entry: [
    // entry bits
  ],
  output: {
    // output bits
  },
  module: {
    rules: [
      // any other rules
      {
        // Exposes jQuery for use outside Webpack build
        test: require.resolve('jquery'),
        use: [{
          loader: 'expose-loader',
          options: 'jQuery'
        },{
          loader: 'expose-loader',
          options: '$'
        }]
      }
    ]
  },
  plugins: [
    // Provides jQuery for other JS bundled with Webpack
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery'
    })
  ]
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: get string from textbox javascript 
Javascript :: jest cannot find module 
Javascript :: check if value is array 
Javascript :: javascript swap array elements 
Javascript :: back button event listener javascript 
Javascript :: infinite loop in javascript 
Javascript :: javascript remove index from array 
Javascript :: Aug 25 2020 00:00:00 GMT+0530 
Javascript :: javascript console.log colors 
Javascript :: callback without duplicates javascript 
Javascript :: .select js 
Javascript :: loop do while javascript 
Javascript :: represent body in javascript 
Javascript :: add object in array state react 
Javascript :: sort array in javascript 
Javascript :: d3js.org 
Javascript :: sum float values in jquery 
Javascript :: angular 11 features 
Javascript :: selection sort javascript 
Javascript :: error first line of nextjs file 
Javascript :: d3 force simulation 
Javascript :: ajax django send array 
Javascript :: syntax of reduce in js 
Javascript :: remove object if key is duplicate javascript 
Javascript :: call a function 
Javascript :: how to use youtube api javascript 
Javascript :: create a regex javascript 
Javascript :: key js 
Javascript :: how to implement certain actions after setstate in react hooks 
Javascript :: while loops js 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =