New to webpack but currently webpack is injecting styles into my document body which I would like to disable. I am not sure how to accomplish this.
Here is my webpack.config.js
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
output: {
filename: 'bundle.js'
},
entry: {
app: './js/app.js'
},
module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({use:[{loader: 'css-loader', options: {importLoaders: 1}}, 'postcss-loader', 'sass-loader']})
}
]
},
plugins: [
new ExtractTextPlugin('styles.css'),
new webpack.LoaderOptionsPlugin({options: {
context: __dirname,
postcss: [
autoprefixer
]
}})
]
};
The html output is
<html>
<head>
<title>Test</title>
<link rel="stylesheet" href="/wp-content/themes/index/styles.css">
<style type="text/css">
body {
background-color: black; }
h1 {
color: #fff; }
p {
display: flex;
color: #fff; }
</style>
<style type="text/css"></style>
</head>
<body>
<h1>Test</h1>
<p>Test</p>
<script src="/wp-content/themes/index/dist/bundle.js"></script>
</body>
</html>
As you can see it is still inject css that doesn't match the scss file I have. It is also not prefixing the the flex property or including an import I have in my sass file.
main.scss
@import 'test';
body {
background-color: black;
}
h1 {
color: #fff;
}
p {
display: flex;
color: #fff;
background-color: red;
}
_test.scss
h2 {
color: blue;
}