0
我安裝引導4與npm。我目前正在使用反應庫。我正在爲es2015蒸蒸日上,並做出反應。也使用webpack。在控制檯我得到關於jQuery的下面的錯誤並從文件transition.js未來:jquery錯誤安裝引導4與npm
Uncaught ReferenceError: jQuery is not defined transition.js
這裏是的WebPack配置:
const webpack = require('webpack');
const path = require('path');
const autoprefixer = require('autoprefixer');
module.exports = {
entry: [
"./client/main.js",
"bootstrap-loader",
],
output: {
path: './public',
filename: "bundle.js",
publicPath: '/'
},
devServer: {
inline: true,
contentBase: './public'
},
module: {
loaders: [
{
test:/\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['react', 'es2015']
}
},
{ test: /\.css$/, loaders: [ 'style', 'css', 'postcss' ] },
{ test: /\.scss$/, loaders: [ 'style', 'css', 'postcss', 'sass' ] },
{ test: /bootstrap\/dist\/js\/umd\//, loader: 'imports?jQuery=jquery!./file.js' },
{ test: /\.(woff2?|ttf|eot|svg)$/, loader: 'url?limit=10000' },
]
},
postcss: [ autoprefixer ]
}
你的jQuery加載程序與文檔稍有不同 - '{test:/ bootstrap \/dist \/js \/umd \ //,loader:'imports?jQuery = jquery'},'that might might是嗎? – Harangue
@Harangue試過,但沒有奏效。然而,發現這篇文章,它確實幫助http://stackoverflow.com/questions/28969861/managing-jquery-plugin-dependency-in-webpack –