Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

메모장

Vue jQuery 플러그인 설정 본문

JavaScript

Vue jQuery 플러그인 설정

doopang 2024. 4. 17. 10:29
npm i @rollup/plugin-inject
npm i jquery

 

webpack.conf.js(webpack)

const webpackConfig = {
    plugins: [
    ...
    new webpack.ProvidePlugin({
      $: 'jquery',
      jquery: 'jquery',
      'window.jQuery': 'jquery',
      jQuery : 'jquery'
    })
  ]
}

 

vite.config.js(vite)

import { defineConfig, loadEnv } from 'vite'
import inject from '@rollup/plugin-inject'

export default ({command, mode}) => {
    return defineConfig({
        plugins: [
            inject({ // 맨 위에 작성
                $: 'jquery',
                jquery: 'jquery',
                'window.jQuery': 'jquery',
                jQuery : 'jquery'
            }),
            ...
        ]
    })
}

 

main.js

import $ from 'jquery'
window.$ = $

'JavaScript' 카테고리의 다른 글

Promise  (0) 2025.05.15
SNS 공유하기  (0) 2024.07.02
Vue Store  (0) 2023.12.26
TOAST UI Grid Pagination(Server)  (0) 2023.12.15
Vue props, emit  (0) 2023.11.21