I switched from including styles in the oldschool way:
<link rel="stylesheet" href="./../css/main.css">
for the webpack approach:
var css = require('./../css/main.css');
This works, but I don't like the fact that it extracts css from this file into an inline tag, because then it is more difficult to debug it in Dev Tools. For example, I have no idea which file and line these attributes come from:

How can I move it to a separate file or create a source map that would point me to the source file? So when I check Dev Tools, it will look like this:

My webpack.config.js:
var autoprefixer = require('autoprefixer');
module.exports = {
devtool: "css-loader?sourceMap",
module: {
loaders: [
{test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000'},
{
test: /\.css$/,
loader: "style-loader!css-loader!postcss-loader"
}
]
},
entry: [
'./static/js/app.js'
],
output: {
filename: './static/js/bundle.js'
},
watch: false,
postcss: function () {
return [autoprefixer];
}
};
My app.js:
var $ = require('jquery');
window.jQuery = $;
window.$ = $;
require('bootstrap-loader');
module.exports = (function () {
alert('IT WORKS!');
});
window.app = module.exports;
var css = require('./../css/main.css');
source
share