/* eslint-disable import/no-extraneous-dependencies */
import { DefinePlugin } from 'webpack';
import Config from 'webpack-config';
import Path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import Autoprefixer from 'autoprefixer';
const appPath = Path.resolve(__dirname, 'app/js');
const stylesPath = Path.resolve(__dirname, 'app/stylus');
export default new Config().extend('webpack.base.babel.js').merge({
entry: appPath,
output: {
filename: 'js/ame.bundle.js',
chunkFilename: 'js/[name].bundle.js',
path: Path.resolve(__dirname, 'build'),
publicPath: '/',
},
module: {
rules: [
{
test: /\.styl$/,
include: [stylesPath, appPath],
use: ExtractTextPlugin.extract({
use: [
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'postcss-loader',
options: {
plugins: () => [Autoprefixer],
},
},
{
loader: 'stylus-loader',
},
]
}),
},
],
},
plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new ExtractTextPlugin({
filename: 'css/ame.bundle.css',
}),
new CleanWebpackPlugin(['build'], {
root: Path.resolve(__dirname),
verbose: true,
dry: false,
}),
],
});