我正在按照bootstrap-sass-loader页面上的说明进行操作。
在我的package.json中,我有以下内容:
"bootstrap-sass": "^3.3.6",
"bootstrap-sass-loader": "^1.0.9"
这是我的 webpack.config.js 文件
module.exports = {
entry: ['./app.js'],
output: {
publicPath: 'http://localhost:8080/',
filename: 'build/bundle.js'
},
devtool: 'eval',
module: {
/* used on code before it's transformed */
preLoaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'source-map'
}
],
/* used to modify code */
loaders: [
{test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery'},
{test: /\.obj|\.mtl|\.html|\.dae|\.txt/, loader: "raw"},
{test: /\.jsx?$/, exclude: /(node_modules)/, loader: 'babel'},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file"},
{test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream"},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml"},
{
test: /\.scss$/,
/* order from bottom to top, so first sass, autoprefix, css and finally style */
loaders: ['style', 'css', 'autoprefixer?browsers=last 3 versions', 'sass?outputStyle=expanded']
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: ['url?limit=8192', 'img']
},
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel'
}
],
/* used to modify generated code */
postLoader: []
}
};
我理解的是我只需要使用
require("bootstrap-sass-loader");
我在我的app.js
中完成了代码,但我无法使用任何Bootstrap样式。我在这里缺少什么?
Error in ./~/bootstrap-sass/assets/javascripts/...
,以及在/home...
路径下的Module not found: 'jquery'
。 - OlehZiniak