Уважаемые знатаки Webpack-а, подскажите как подключить autoprefixer
const webpack = require('webpack');
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const extractSass = new ExtractTextPlugin({
filename: "./assets/css/styles.css"
});
module.exports = {
entry: {
app: './src/js/app.js',
about: './src/js/about.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: './assets/js/[name].js',
library: '[name]'
},
module: {
rules: [
{
test: /\.sass|scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader'],
publicPath: './dist/assets/css/'
})
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['env'],
plugins: ['transform-runtime']
}
}
]
},
devtool: "cheap-eval-source-map",
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
stats: 'errors-only',
open: true
},
plugins: [
extractSass,
new HtmlWebpackPlugin({
title: 'My App',
filename: 'index.html',
template: './src/index.html',
hash: true,
// minify: { collapseWhitespace: true },
chunks: ['app', 'common']
}),
new HtmlWebpackPlugin({
title: 'About',
filename: 'about.html',
template: './src/about.html',
hash: true,
// minify: { collapseWhitespace: true },
chunks: ['about', 'common']
}),
new ExtractTextPlugin("./assets/css/styles.css"),
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
chunks: ['about', 'app']
}),
// new UglifyJSPlugin(),
]
}
Решение которе я нашел
создал с рядом webpack.config.js файл postcss.config.js
в него добавил
module.exports = {
plugins: [
require('autoprefixer')
]
}
и добавил postcss-loader
use: ['css-loader', 'postcss-loader', 'sass-loader'],
так же можно добавить в package.json для поддержки нужных префиксов
"browserslist": [
"> 1%",
"last 2 versions"
]