Created
March 28, 2018 14:54
-
-
Save 1littleOrc/07663335468c3c9471a889e00aa43420 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
webpack = require('webpack'); | |
path = require('path'); | |
const HtmlWebPackPlugin = require("html-webpack-plugin"); | |
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
path: __dirname + '/dist', | |
filename: 'main.js' | |
}, | |
module: { | |
rules: [{ | |
test: /\.(png|jpg|gif)$/, | |
use: [{ | |
loader: 'file-loader', | |
options: {} | |
}] | |
}, | |
{ | |
test: /\.svg$/, | |
loader: 'svg-inline-loader' | |
}, | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: { | |
loader: "babel-loader" | |
} | |
}, | |
{ | |
test: /\.pug$/, | |
use: [{ | |
loader: 'html-loader' | |
}, | |
{ | |
loader: 'pug-html-loader', | |
options: {} | |
} | |
] | |
}, | |
{ | |
test: /\.html$/, | |
use: [{ | |
loader: "html-loader", | |
options: { | |
// minimize: true | |
} | |
}] | |
}, | |
{ | |
test: /\.(css|sass|scss)$/, | |
use: [ | |
MiniCssExtractPlugin.loader, | |
{ | |
loader: 'css-loader', | |
options: { | |
importLoaders: 2, | |
sourceMap: true | |
} | |
}, | |
{ | |
loader: 'postcss-loader', | |
options: { | |
plugins: () => [ | |
require('autoprefixer') | |
], | |
sourceMap: true | |
} | |
}, | |
{ | |
loader: 'sass-loader', | |
options: { | |
sourceMap: true | |
} | |
} | |
] | |
} | |
] | |
}, | |
plugins: [ | |
new HtmlWebPackPlugin({ | |
filename: 'index.html', | |
template: './src/index.pug' | |
}), | |
new HtmlWebPackPlugin({ | |
filename: 'buy.html', | |
template: './src/buy.pug', | |
chunks: [] | |
}), | |
new HtmlWebPackPlugin({ | |
filename: 'carousel.html', | |
template: './src/carousel.pug', | |
chunks: [] | |
}), | |
new MiniCssExtractPlugin({ | |
filename: "[name].css", | |
chunkFilename: "[id].css" | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment