build: remove webpack dll config

This commit is contained in:
Haishan 2019-12-27 22:53:00 +08:00
parent 862816a28a
commit f0f4befc28
5 changed files with 6 additions and 71 deletions

View file

@ -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",

View file

@ -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()
);

View file

@ -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/') >=

View file

@ -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'
// };

View file

@ -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/react-dom@16.10.2":
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"
"@hsjs/react-cache@0.0.0-alpha.aa94237":
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 @@ scheduler@0.0.0-experimental-f42431abe:
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"