build: upgrade deps

This commit is contained in:
Haishan 2020-04-16 15:18:28 +08:00
parent 16fe2b7769
commit 2ef14e63c0
4 changed files with 616 additions and 562 deletions

View file

@ -86,9 +86,9 @@
"eslint-plugin-jest": "^23.6.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.17.0",
"eslint-plugin-react-hooks": "^2.5.1",
"eslint-plugin-react-hooks": "^3.0.0",
"file-loader": "^6.0.0",
"html-webpack-plugin": "^3.2.0",
"html-webpack-plugin": "^4.2.0",
"husky": "^4.0.0",
"lint-staged": "^10.0.7",
"mini-css-extract-plugin": "^0.9.0",
@ -98,7 +98,7 @@
"postcss-loader": "^3.0.0",
"postcss-nested": "^4.2.0",
"postcss-simple-vars": "^5.0.2",
"prettier": "^1.17.1",
"prettier": "^2.0.4",
"react-refresh": "0.0.0-experimental-241c4467e",
"resize-observer-polyfill": "^1.5.1",
"style-loader": "^1.1.2",

View file

@ -21,16 +21,8 @@
<meta property="og:url" content="http://yacd.haishan.me">
<meta property="og:description" content="Yet Another Clash Dashboard">
<% for (key in htmlWebpackPlugin.files.css) { %>
<link href="<%= htmlWebpackPlugin.files.css[key] %>" rel="stylesheet">
<% } %>
<body>
<div id="app"></div>
<% for (key in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[key].entry %>" type="text/javascript"></script>
<% } %>
</body>
</html>

View file

@ -19,14 +19,14 @@ const isDev = process.env.NODE_ENV !== 'production';
const html = new HTMLPlugin({
title: 'yacd - Yet Another Clash Dashboard',
template: 'src/index.template.ejs',
inject: false,
filename: 'index.html'
scriptLoading: 'defer',
filename: 'index.html',
});
const definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(isDev),
__VERSION__: JSON.stringify(pkg.version),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
});
const postcssPlugins = () =>
@ -40,25 +40,25 @@ const postcssPlugins = () =>
'--breakpoint-not-small': 'screen and (min-width: 30em)',
'--breakpoint-medium':
'screen and (min-width: 30em) and (max-width: 60em)',
'--breakpoint-large': 'screen and (min-width: 60em)'
}
}
]
'--breakpoint-large': 'screen and (min-width: 60em)',
},
},
],
}),
require('postcss-nested')(),
require('autoprefixer')(),
require('postcss-extend-rule')(),
isDev ? false : require('cssnano')()
isDev ? false : require('cssnano')(),
].filter(Boolean);
const cssExtractPlugin = new MiniCssExtractPlugin({
filename: isDev ? '[name].css' : '[name].[contenthash].css'
filename: isDev ? '[name].css' : '[name].[contenthash].css',
});
const bundleAnalyzerPlugin = new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'report.html',
openAnalyzer: false
openAnalyzer: false,
});
const plugins = [
@ -73,7 +73,7 @@ const plugins = [
isDev ? new ReactRefreshWebpackPlugin({ disableRefreshCheck: true }) : false,
// isDev ? false : new webpack.HashedModuleIdsPlugin(),
isDev ? false : cssExtractPlugin,
isDev ? false : bundleAnalyzerPlugin
isDev ? false : bundleAnalyzerPlugin,
].filter(Boolean);
module.exports = {
@ -81,12 +81,12 @@ module.exports = {
devtool: isDev ? 'eval-source-map' : false,
entry: {
// app: ['react-hot-loader/patch', './src/app.js']
app: ['./src/app.js']
app: ['./src/app.js'],
},
output: {
path: path.resolve(__dirname, 'public'),
filename: isDev ? '[name].js' : '[name].[contenthash].js',
publicPath: ''
publicPath: '',
},
mode: isDev ? 'development' : 'production',
module: {
@ -94,11 +94,11 @@ module.exports = {
{
test: /\.js$/,
exclude: /node_modules/,
use: { loader: 'babel-loader', options: { cacheDirectory: true } }
use: { loader: 'babel-loader', options: { cacheDirectory: true } },
},
{
test: /\.(ttf|eot|woff|woff2)(\?.+)?$/,
use: [{ loader: 'file-loader', options: { name: '[name].[ext]' } }]
use: [{ loader: 'file-loader', options: { name: '[name].[ext]' } }],
},
{
test: /\.css$/,
@ -106,8 +106,8 @@ module.exports = {
use: [
isDev ? { loader: 'style-loader' } : MiniCssExtractPlugin.loader,
{ loader: 'css-loader' },
{ loader: 'postcss-loader', options: { plugins: postcssPlugins } }
].filter(Boolean)
{ loader: 'postcss-loader', options: { plugins: postcssPlugins } },
].filter(Boolean),
},
{
test: /\.module\.css$/,
@ -119,17 +119,17 @@ module.exports = {
modules: {
localIdentName: isDev
? '[path]_[name]_[local]_[hash:base64:5]'
: '[hash:base64:10]'
}
}
: '[hash:base64:10]',
},
},
},
{
loader: 'postcss-loader',
options: { plugins: postcssPlugins }
}
].filter(Boolean)
}
]
options: { plugins: postcssPlugins },
},
].filter(Boolean),
},
],
},
optimization: {
moduleIds: isDev ? 'named' : 'hashed',
@ -143,7 +143,7 @@ module.exports = {
module.resource &&
module.resource.indexOf('node_modules/core-js/') >= 0
);
}
},
},
react: {
test(module, _chunks) {
@ -154,11 +154,11 @@ module.exports = {
module.resource.indexOf('node_modules/react-dom/') >= 0 ||
module.resource.indexOf('node_modules/react/') >= 0)
);
}
}
}
},
},
},
},
minimizer: [new TerserPlugin()]
minimizer: [new TerserPlugin()],
},
plugins
plugins,
};

1102
yarn.lock

File diff suppressed because it is too large Load diff