mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-29 12:31:02 +00:00
dce3c84c9c
Update javascript deps to latest version. Rebuild assets - Keep `stylehint` in a lower version because starting at v9.0.0 it generates too much errors. We might fix them later. - Don't touch `materialize-css` to avoid too much side effect. We might update it later (to 1.0.0).
120 lines
2.8 KiB
JavaScript
120 lines
2.8 KiB
JavaScript
const webpack = require('webpack');
|
|
const { merge } = require('webpack-merge');
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
|
|
const commonConfig = require('./common.js');
|
|
|
|
module.exports = function () {
|
|
return merge(commonConfig(), {
|
|
output: {
|
|
filename: '[name].js',
|
|
},
|
|
mode: 'production',
|
|
devtool: 'source-map',
|
|
optimization: {
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
cache: true,
|
|
parallel: true,
|
|
sourceMap: true,
|
|
terserOptions: {
|
|
output: {
|
|
comments: false,
|
|
},
|
|
},
|
|
extractComments: false,
|
|
}),
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
'process.env': {
|
|
'NODE_ENV': JSON.stringify('production'),
|
|
},
|
|
}),
|
|
new MiniCssExtractPlugin({
|
|
filename: '[name].css',
|
|
chunkFilename: '[id].css',
|
|
}),
|
|
new ManifestPlugin({
|
|
fileName: 'manifest.json',
|
|
}),
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
enforce: 'pre',
|
|
test: /\.js$/,
|
|
loader: 'eslint-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /(node_modules)/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: ['@babel/preset-env']
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.(sa|sc|c)ss$/,
|
|
use: [
|
|
{
|
|
loader: MiniCssExtractPlugin.loader,
|
|
options: {
|
|
hmr: process.env.NODE_ENV === 'development',
|
|
},
|
|
},
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
importLoaders: 1,
|
|
},
|
|
},
|
|
{
|
|
loader: 'postcss-loader',
|
|
options: {
|
|
plugins: [require('autoprefixer')({})],
|
|
},
|
|
},
|
|
'sass-loader',
|
|
],
|
|
},
|
|
{
|
|
test: /\.(jpg|png|gif|svg|ico)$/,
|
|
include: /node_modules/,
|
|
use: {
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: 'img/[name].[ext]',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.(jpg|png|gif|svg|ico)$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'file-loader',
|
|
options: {
|
|
context: 'app/Resources/static',
|
|
name: '[path][name].[ext]',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
test: /\.(eot|ttf|woff|woff2)$/,
|
|
use: {
|
|
loader: 'file-loader',
|
|
options: {
|
|
name: 'fonts/[name].[ext]',
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
};
|