作者:九天0307_963 | 来源:互联网 | 2022-04-14 18:23
第一步,安装jquery。||第二步,在webpack.config.js添加内容。||第三步,在入口文件index.js里面添加内容。||第四步,安装Bootstrap。||第五步,在入口文件index.js里引入bootstrap代码。
一、引入jquery
步骤:
1. 安装jquery
$ npm install jquery --save-dev
2.在webpack.config.js 添加内容
+ const webpack = require("webpack");
module.exports = {
entry: './index.js',
output: {
path: path.join(__dirname, './dist'),
publicPath: '/dist/',
filename: 'index.js'
},
+ plugins: [
new webpack.ProvidePlugin({
jQuery: 'jquery',
$: 'jquery'
})
]
}
3.在入口文件index.js 里面添加内容
import $ from 'jquery' ;