forked from wallabag/wallabag
Webpack upgraded from 4 to 5 + dependancies updated
This commit is contained in:
@ -4,37 +4,35 @@ const StyleLintPlugin = require('stylelint-webpack-plugin');
|
||||
|
||||
const rootDir = path.resolve(__dirname, '../../../');
|
||||
|
||||
module.exports = function () {
|
||||
return {
|
||||
entry: {
|
||||
material: path.join(rootDir, './app/Resources/static/themes/material/index.js'),
|
||||
baggy: path.join(rootDir, './app/Resources/static/themes/baggy/index.js'),
|
||||
public: path.join(rootDir, './app/Resources/static/themes/_global/share.js'),
|
||||
module.exports = {
|
||||
entry: {
|
||||
material: path.join(rootDir, './app/Resources/static/themes/material/index.js'),
|
||||
baggy: path.join(rootDir, './app/Resources/static/themes/baggy/index.js'),
|
||||
public: path.join(rootDir, './app/Resources/static/themes/_global/share.js'),
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: path.resolve(rootDir, 'web/wallassets'),
|
||||
publicPath: '',
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery',
|
||||
'window.$': 'jquery',
|
||||
'window.jQuery': 'jquery',
|
||||
}),
|
||||
new StyleLintPlugin({
|
||||
configFile: '.stylelintrc',
|
||||
failOnError: false,
|
||||
quiet: false,
|
||||
context: 'app/Resources/static/themes',
|
||||
files: '**/*.scss',
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
jquery: path.join(rootDir, 'node_modules/jquery/dist/jquery.js'),
|
||||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: path.resolve(rootDir, 'web/wallassets'),
|
||||
publicPath: '',
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery',
|
||||
'window.$': 'jquery',
|
||||
'window.jQuery': 'jquery',
|
||||
}),
|
||||
new StyleLintPlugin({
|
||||
configFile: '.stylelintrc',
|
||||
failOnError: false,
|
||||
quiet: false,
|
||||
context: 'app/Resources/static/themes',
|
||||
files: '**/*.scss',
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
jquery: path.join(rootDir, 'node_modules/jquery/dist/jquery.js'),
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@ -2,64 +2,64 @@ const { merge } = require('webpack-merge');
|
||||
const webpack = require('webpack');
|
||||
const commonConfig = require('./common.js');
|
||||
|
||||
module.exports = function () {
|
||||
return merge(commonConfig(), {
|
||||
devtool: 'eval-source-map',
|
||||
output: {
|
||||
filename: '[name].dev.js',
|
||||
},
|
||||
mode: 'development',
|
||||
devServer: {
|
||||
hot: true,
|
||||
// enable HMR on the server
|
||||
contentBase: './web',
|
||||
// match the output path
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
],
|
||||
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']
|
||||
},
|
||||
module.exports = merge(commonConfig, {
|
||||
devtool: 'eval-source-map',
|
||||
output: {
|
||||
filename: '[name].dev.js',
|
||||
},
|
||||
mode: 'development',
|
||||
devServer: {
|
||||
hot: true,
|
||||
// enable HMR on the server
|
||||
contentBase: './web',
|
||||
// match the output path
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
],
|
||||
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: /\.(s)?css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
},
|
||||
{
|
||||
test: /\.(s)?css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
postcssOptions: {
|
||||
plugins: ['autoprefixer'],
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
plugins: [require('autoprefixer')({})],
|
||||
},
|
||||
},
|
||||
'sass-loader',
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|gif|svg|ico|eot|ttf|woff|woff2)$/,
|
||||
use: 'url-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
};
|
||||
},
|
||||
'sass-loader',
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.(jpg|png|gif|svg|ico|eot|ttf|woff|woff2)$/,
|
||||
use: 'url-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@ -6,115 +6,106 @@ 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,
|
||||
},
|
||||
module.exports = merge(commonConfig, {
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
},
|
||||
mode: 'production',
|
||||
devtool: 'source-map',
|
||||
optimization: {
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
parallel: 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',
|
||||
extractComments: false,
|
||||
}),
|
||||
],
|
||||
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']
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
NODE_ENV: JSON.stringify('production'),
|
||||
},
|
||||
}),
|
||||
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',
|
||||
},
|
||||
{
|
||||
test: /\.(sa|sc|c)ss$/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
postcssOptions: {
|
||||
plugins: ['autoprefixer'],
|
||||
},
|
||||
},
|
||||
{
|
||||
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]',
|
||||
},
|
||||
},
|
||||
'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: /\.(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]',
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.(eot|ttf|woff|woff2)$/,
|
||||
use: {
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'fonts/[name].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
};
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user