summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaishan <[email protected]>2019-12-27 22:53:00 +0800
committerHaishan <[email protected]>2019-12-28 00:54:46 +0800
commitf0f4befc28144e78d6f6dfddf8315ec03fd15c0a (patch)
tree90b28473f16ba20f25ccebf88de8ed5e29a10e74
parent862816a28a72c4e9e02829af14f8c548091268bb (diff)
build: remove webpack dll config
-rw-r--r--package.json2
-rw-r--r--server.js2
-rw-r--r--webpack.config.js13
-rw-r--r--webpack.dll.config.js42
-rw-r--r--yarn.lock18
5 files changed, 6 insertions, 71 deletions
diff --git a/package.json b/package.json
index 9f003ed..82e12f7 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,6 @@
"main": "index.js",
"scripts": {
"lint": "eslint --cache src",
- "dll": "webpack --config webpack.dll.config.js",
"start": "NODE_ENV=development node server.js",
"build": "NODE_ENV=production webpack -p --progress",
"pretty": "prettier --single-quote --write 'src/**/*.{js,scss}'"
@@ -35,7 +34,6 @@
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.7.7",
- "@hot-loader/react-dom": "16.10.2",
"@hsjs/react-cache": "0.0.0-alpha.aa94237",
"@sentry/browser": "^5.9.1",
"chart.js": "^2.9.2",
diff --git a/server.js b/server.js
index 0d33326..9fad774 100644
--- a/server.js
+++ b/server.js
@@ -15,8 +15,6 @@ const port = PORT ? Number(PORT) : 3000;
config.entry.app.unshift('webpack-hot-middleware/client');
config.plugins.push(
new webpack.HotModuleReplacementPlugin(),
- // prints more readable module names in the browser console on HMR updates
- new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin()
);
diff --git a/webpack.config.js b/webpack.config.js
index 6b9d159..361c459 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -3,6 +3,8 @@
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
+const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
+const HTMLPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
@@ -14,7 +16,6 @@ const pkg = require('./package.json');
process.env.BABEL_ENV = process.env.NODE_ENV;
const isDev = process.env.NODE_ENV !== 'production';
-const HTMLPlugin = require('html-webpack-plugin');
const html = new HTMLPlugin({
title: 'yacd - Yet Another Clash Dashboard',
template: 'src/index.template.ejs',
@@ -54,7 +55,6 @@ const cssExtractPlugin = new MiniCssExtractPlugin({
filename: isDev ? '[name].css' : '[name].[contenthash].css'
});
-const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const bundleAnalyzerPlugin = new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'report.html',
@@ -62,7 +62,6 @@ const bundleAnalyzerPlugin = new BundleAnalyzerPlugin({
});
const plugins = [
- // in webpack 4 namedModules will be enabled by default
html,
definePlugin,
new CopyPlugin([{ from: 'assets/*', flatten: true }]),
@@ -72,7 +71,7 @@ const plugins = [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// https://github.com/pmmmwh/react-refresh-webpack-plugin
isDev ? new ReactRefreshWebpackPlugin({ disableRefreshCheck: true }) : false,
- isDev ? false : new webpack.HashedModuleIdsPlugin(),
+ // isDev ? false : new webpack.HashedModuleIdsPlugin(),
isDev ? false : cssExtractPlugin,
isDev ? false : bundleAnalyzerPlugin
].filter(Boolean);
@@ -165,13 +164,13 @@ module.exports = {
]
},
optimization: {
- moduleIds: 'hashed',
+ moduleIds: isDev ? 'named' : 'hashed',
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
cacheGroups: {
'core-js': {
- test(module, chunks) {
+ test(module, _chunks) {
return (
module.resource &&
module.resource.indexOf('node_modules/core-js/') >= 0
@@ -179,7 +178,7 @@ module.exports = {
}
},
react: {
- test(module, chunks) {
+ test(module, _chunks) {
return (
module.resource &&
(module.resource.indexOf('node_modules/@hot-loader/react-dom/') >=
diff --git a/webpack.dll.config.js b/webpack.dll.config.js
deleted file mode 100644
index ba62948..0000000
--- a/webpack.dll.config.js
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict';
-
-const webpack = require('webpack');
-const path = require('path');
-
-module.exports = {
- resolve: {
- extensions: ['.js', '.jsx']
- },
- entry: {
- vendor: [
- 'babel-polyfill',
- 'react',
- 'react-dom',
- 'redux',
- 'react-router-dom'
- ]
- },
- output: {
- path: path.resolve(__dirname, 'public'),
- // this will generate vendor.bundle.js
- // commons chunk plugin will also vendor.bundle.js
- // the benefit is we reuse the vendor <script /> tag in our index.html
- //
- // since this dll plugin is only used in dev
- // and commons chunk plugin is only used in prod
- // there is no conflict
- filename: '[name].dll.js',
- library: '[name]_[hash]'
- },
- plugins: [
- new webpack.DllPlugin({
- path: path.join(__dirname, 'public', '[name]-manifest.json'),
- name: '[name]_[hash]'
- })
- ]
-};
-
-// const output = {
-// filename: '[name].bundle.js',
-// publicPath: '/assets'
-// };
diff --git a/yarn.lock b/yarn.lock
index fc6bb6d..9cac581 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -795,16 +795,6 @@
resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.3.tgz#5b6b1c11d6a6dddf1f2fc996f74cf3b219644d78"
integrity sha512-2Md9mH6mvo+ygq1trTeVp2uzAKwE2P7In0cRpD/M9Q70aH8L+rxMLbb3JCN2JoSWsV2O+DdFjfbbXoMoLBczow==
-"@hot-loader/[email protected]":
- version "16.10.2"
- resolved "https://registry.yarnpkg.com/@hot-loader/react-dom/-/react-dom-16.10.2.tgz#91920442252acac6f343eef5df41aca333f7dcea"
- integrity sha512-vbrSDuZMoE1TXiDNAVCSAcIS6UX55Fa9KF0MD0wQgOaOIPZs/C6CtEDUcnNFEwTQ5ciIULcp+96lQlSuANNagA==
- dependencies:
- loose-envify "^1.1.0"
- object-assign "^4.1.1"
- prop-types "^15.6.2"
- scheduler "^0.16.2"
-
version "0.0.0-alpha.aa94237"
resolved "https://registry.yarnpkg.com/@hsjs/react-cache/-/react-cache-0.0.0-alpha.aa94237.tgz#1fd83e125a78f3252a15943140e0497d5830d2e3"
@@ -7221,14 +7211,6 @@ [email protected]:
loose-envify "^1.1.0"
object-assign "^4.1.1"
-scheduler@^0.16.2:
- version "0.16.2"
- resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.2.tgz#f74cd9d33eff6fc554edfb79864868e4819132c1"
- integrity sha512-BqYVWqwz6s1wZMhjFvLfVR5WXP7ZY32M/wYPo04CcuPM7XZEbV2TBNW7Z0UkguPTl0dWMA59VbNXxK6q+pHItg==
- dependencies:
- loose-envify "^1.1.0"
- object-assign "^4.1.1"
-
schema-utils@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770"