Ich baue eine App mit react, bootstrap und webpack mit es6 mit babel.Webpack import bootstrap .js und .css
Aber ich kann nicht Boosterrap.js und Bootstrap.css zu meiner App importieren.
Mein webpack.config.js
var webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
path = require('path'),
srcPath = path.join(__dirname, 'src');
module.exports = {
target: 'web',
cache: true,
entry: {
module: path.join(srcPath, 'module.js'),
common: ['react', 'react-router', 'alt']
},
resolve: {
root: srcPath,
extensions: ['', '.js'],
modulesDirectories: ['node_modules', 'src']
},
output: {
path: path.join(__dirname, 'tmp'),
publicPath: '',
filename: '[name].js',
library: ['Example', '[name]'],
pathInfo: true
},
module: {
loaders: [
{test: /\.js?$/, exclude: /node_modules/, loader: 'babel?cacheDirectory'}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('common', 'common.js'),
new HtmlWebpackPlugin({
inject: true,
template: 'src/index.html'
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}),
new webpack.ProvidePlugin({
bootstrap: "bootstrap.css",
}),
new webpack.NoErrorsPlugin()
],
debug: true,
devtool: 'eval-cheap-module-source-map',
devServer: {
contentBase: './tmp',
historyApiFallback: true
}
};
Also in meinen Js-Dateien (reagieren Komponenten) Ich versuche zu tun: 'Bootstrap' importieren. Aber das CSS wird nicht implementiert. Der Import von .js funktioniert gut.
Also, wie kann ich Bootrap importieren oder Webpack konfigurieren?
Ich schaffte es mit dem Guide gefunden [hier] (http://blog.theodybrothers.com/2015/07/how-to-use-bootstrap-css-only-and). html): Es hilft nur beim Laden von bootstrap.css aber das ist alles was ich brauchte. –