메모장
Vue jQuery 플러그인 설정 본문
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' 카테고리의 다른 글
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 |
TOAST UI Grid Pagination Using Callbacks (0) | 2023.09.16 |