Ne peut pas faire de bootstrap travailler avec Webpack

Je travaille avec un webpack-dev-server et je suis en train d'essayer d'inclure bootstrap.

J'ai cette structure de projet:

── css
   └── bootstrap.min.css
│── js
|   └── bootstrap.min.js
├── dist
├── index.html
├── package.json
├── server.js
├── src
   ├── actions.js
   ├── App.js
   ├── components
   ├── constants
   ├── index.js
   └── reducers.js
└── webpack.config.js

C'est le index.html:

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="css/bootstrap.min.css">
  </head>
  <body>
    <div id='root'></div>
    <script src="/static/bundle.js"></script>
  </body>    
</html>

Chaque fois que je lance le serveur, j'obtiens une erreur du type:

Cannot GET /css/bootstrap.min.css

Ici est la webpack.config.js:

var path = require('path');
var webpack = require('webpack');

module.exports = {
  devtool: 'eval',
  entry: [
    'webpack-dev-server/client?http://localhost:3000',
    'webpack/hot/only-dev-server',
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  module: {
    loaders: [{
      test: /\.js$/,
      loaders: ['react-hot', 'babel'],
      include: path.join(__dirname, 'src')
    },
    {
      test: /\.css$/,
      loader: 'style!css'
    }]
  },
  resolve: {
    extensions: ['', '.js', '.jsx', '.json']
  }
};

Tout le reste fonctionne bien, le problème est juste de bootstrap. J'ai essayé beaucoup de différentes variations sur les configurations, mais je ne peux pas le faire fonctionner.

J'ai aussi essayé l'obligeant directement à partir de javascript sur index.js:

import '../css/bootstrap.min.css';

Et j'obtiens cette erreur:

ERROR in ./~/css-loader!./css/bootstrap.min.css
Module not found: Error: Cannot resolve 'file' or 'directory' ../fonts/glyphicons-halflings-regular.eot in /home/lhahn/dev/javascript/sha/css
 @ ./~/css-loader!./css/bootstrap.min.css 6:3278-3330 6:3348-3400

Modifier

De ce que j'ai compris, webpack est d'essayer de trouver un fichier de police à l'intérieur de mon projet, lorsque vous essayez d'importer des fichiers d'amorce.min.css.

OriginalL'auteur lhahn | 2016-01-17