- 入口文件 — index.js
window.$ = require('jquery')
- webpack.config.js
const webpack = require('webpack')
module.exports = {
...
plugins: [
...
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
...
]
...
}
window.$ = require('jquery')
const webpack = require('webpack')
module.exports = {
...
plugins: [
...
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
...
]
...
}