mirror of
https://github.com/gurnec/removeddit.git
synced 2026-03-11 08:54:27 +00:00
74 lines
1.5 KiB
JavaScript
74 lines
1.5 KiB
JavaScript
const path = require('path');
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
|
|
const extractSass = new ExtractTextPlugin({
|
|
filename: 'bundle.[contenthash].css',
|
|
});
|
|
|
|
module.exports = {
|
|
entry: [
|
|
'@babel/polyfill',
|
|
'whatwg-fetch',
|
|
'./src/js/index.js',
|
|
],
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'bundle.[chunkhash].js',
|
|
publicPath: '/',
|
|
},
|
|
resolve: {
|
|
modules: [
|
|
path.resolve('./src/js'),
|
|
path.resolve('./node_modules'),
|
|
],
|
|
},
|
|
module: {
|
|
loaders: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: [
|
|
{
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.html$/,
|
|
loader: 'html-loader',
|
|
},
|
|
{
|
|
test: /\.sass$/,
|
|
loader: extractSass.extract({
|
|
use: ['css-loader', 'sass-loader'],
|
|
}),
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new CleanWebpackPlugin(['dist']),
|
|
extractSass,
|
|
new HtmlWebpackPlugin({
|
|
template: 'src/index.html',
|
|
}),
|
|
new CopyWebpackPlugin([
|
|
{
|
|
from: 'src/404.html',
|
|
to: '404.html',
|
|
},
|
|
{
|
|
from: 'src/images',
|
|
to: 'images/',
|
|
},
|
|
]),
|
|
],
|
|
stats: {
|
|
colors: true,
|
|
},
|
|
}
|