I am working with webpack-dev-server and I am trying to enable download.
I have this project structure:
── 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
This is 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>
Whenever I start the server, I get an error like:
Cannot GET /css/bootstrap.min.css
Here is 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'] } };
Everything else works fine, the problem is that it's just a bootstrap. I tried many different configuration options, but I can't get it to work.
I also tried it directly from javascript on index.js :
import '../css/bootstrap.min.css';
And I get this error:
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
Edit
From what I understood, webpack is trying to find the font file inside my project when trying to import Bootstrap.min.css.