Remove webpack-on-build plugin
parent
a1b7eda7b2
commit
640fdbe0c5
|
@ -94,7 +94,6 @@
|
|||
"json-loader": "^0.5.7",
|
||||
"mini-css-extract-plugin": "^0.4.0",
|
||||
"node-sass": "^4.5.3",
|
||||
"on-build-webpack": "^0.1.0",
|
||||
"postcss-browser-reporter": "^0.4.0",
|
||||
"postcss-calc": "^5.2.0",
|
||||
"postcss-loader": "^2.1.5",
|
||||
|
@ -119,7 +118,7 @@
|
|||
"webpack": "^4.12.0",
|
||||
"webpack-bundle-analyzer": "^2.10.1",
|
||||
"webpack-cli": "^3.0.3",
|
||||
"webpack-dev-server": "^2.11.1"
|
||||
"webpack-dev-server": "^3.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
const path = require('path')
|
||||
const fs = require('fs')
|
||||
const webpack = require('webpack')
|
||||
// const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const WebpackOnBuildPlugin = require('on-build-webpack')
|
||||
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin')
|
||||
const keys = require('lodash/keys')
|
||||
const difference = require('lodash/difference')
|
||||
|
@ -35,6 +33,7 @@ const stats = {
|
|||
children: false,
|
||||
modules: false,
|
||||
version: false,
|
||||
warnings: false,
|
||||
assetsSort: '!size',
|
||||
excludeAssets: [/\.(hot-update|woff|eot|ttf|svg|ico|png)/],
|
||||
}
|
||||
|
@ -100,7 +99,6 @@ module.exports = {
|
|||
test: /\.scss$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
|
@ -162,9 +160,6 @@ module.exports = {
|
|||
},
|
||||
plugins: [
|
||||
new ProgressBarPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('development'),
|
||||
}),
|
||||
new webpack.DllReferencePlugin({
|
||||
context: process.cwd(),
|
||||
manifest: require('../build/vendor.dll.json'),
|
||||
|
@ -186,7 +181,8 @@ module.exports = {
|
|||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'style.[contenthash].css',
|
||||
filename: 'chronograf.css',
|
||||
chunkFilename: '[id].css',
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.resolve(__dirname, '..', 'src', 'index.template.html'),
|
||||
|
@ -200,33 +196,37 @@ module.exports = {
|
|||
new webpack.DefinePlugin({
|
||||
VERSION: JSON.stringify(require('../package.json').version),
|
||||
}),
|
||||
new WebpackOnBuildPlugin(webpackStats => {
|
||||
const newlyCreatedAssets = webpackStats.compilation.assets
|
||||
fs.readdir(buildDir, (readdirErr, buildDirFiles) => {
|
||||
if (readdirErr) {
|
||||
console.error('webpack build directory error')
|
||||
return
|
||||
}
|
||||
{
|
||||
apply: compiler => {
|
||||
compiler.hooks.afterEmit.tap('AfterEmitPlugin', compilation => {
|
||||
const newlyCreatedAssets = compilation.assets
|
||||
fs.readdir(buildDir, (readdirErr, buildDirFiles) => {
|
||||
if (readdirErr) {
|
||||
console.error('webpack build directory error')
|
||||
return
|
||||
}
|
||||
|
||||
const assetFileNames = keys(newlyCreatedAssets)
|
||||
const filesToRemove = difference(buildDirFiles, assetFileNames)
|
||||
const assetFileNames = keys(newlyCreatedAssets)
|
||||
const filesToRemove = difference(buildDirFiles, assetFileNames)
|
||||
|
||||
for (const file of filesToRemove) {
|
||||
if (file.includes('dll')) {
|
||||
return
|
||||
}
|
||||
|
||||
const ext = path.extname(file)
|
||||
if (['.js', '.json', '.map'].includes(ext)) {
|
||||
fs.unlink(path.join(buildDir, file), unlinkErr => {
|
||||
if (unlinkErr) {
|
||||
console.error('webpack cleanup error', unlinkErr)
|
||||
for (const file of filesToRemove) {
|
||||
if (file.includes('dll')) {
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
|
||||
const ext = path.extname(file)
|
||||
if (['.js', '.json', '.map'].includes(ext)) {
|
||||
fs.unlink(path.join(buildDir, file), unlinkErr => {
|
||||
if (unlinkErr) {
|
||||
console.error('webpack cleanup error', unlinkErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
],
|
||||
target: 'web',
|
||||
devServer: {
|
||||
|
|
|
@ -5,6 +5,7 @@ const dependencies = packages.dependencies
|
|||
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
node: {
|
||||
fs: 'empty',
|
||||
module: 'empty',
|
||||
|
|
109
ui/yarn.lock
109
ui/yarn.lock
|
@ -4388,14 +4388,14 @@ http-parser-js@>=0.4.0:
|
|||
version "0.4.11"
|
||||
resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.11.tgz#5b720849c650903c27e521633d94696ee95f3529"
|
||||
|
||||
http-proxy-middleware@~0.17.4:
|
||||
version "0.17.4"
|
||||
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.17.4.tgz#642e8848851d66f09d4f124912846dbaeb41b833"
|
||||
http-proxy-middleware@~0.18.0:
|
||||
version "0.18.0"
|
||||
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-0.18.0.tgz#0987e6bb5a5606e5a69168d8f967a87f15dd8aab"
|
||||
dependencies:
|
||||
http-proxy "^1.16.2"
|
||||
is-glob "^3.1.0"
|
||||
lodash "^4.17.2"
|
||||
micromatch "^2.3.11"
|
||||
is-glob "^4.0.0"
|
||||
lodash "^4.17.5"
|
||||
micromatch "^3.1.9"
|
||||
|
||||
http-proxy@^1.16.2:
|
||||
version "1.17.0"
|
||||
|
@ -5860,7 +5860,7 @@ lodash@^4.0.0, lodash@^4.1.0, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.2.0, lod
|
|||
version "4.17.5"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
|
||||
|
||||
lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.2, lodash@~4.17.4:
|
||||
lodash@^4.13.1, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.5, lodash@~4.17.4:
|
||||
version "4.17.10"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
|
||||
|
||||
|
@ -5870,10 +5870,23 @@ log-symbols@^1.0.2:
|
|||
dependencies:
|
||||
chalk "^1.0.0"
|
||||
|
||||
log-symbols@^2.1.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a"
|
||||
dependencies:
|
||||
chalk "^2.0.1"
|
||||
|
||||
loglevel@^1.4.1:
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.1.tgz#e0fc95133b6ef276cdc8887cdaf24aa6f156f8fa"
|
||||
|
||||
loglevelnext@^1.0.1:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/loglevelnext/-/loglevelnext-1.0.5.tgz#36fc4f5996d6640f539ff203ba819641680d75a2"
|
||||
dependencies:
|
||||
es6-symbol "^3.1.1"
|
||||
object.assign "^4.1.0"
|
||||
|
||||
long@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/long/-/long-3.2.0.tgz#d821b7138ca1cb581c172990ef14db200b5c474b"
|
||||
|
@ -5888,7 +5901,7 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3
|
|||
dependencies:
|
||||
js-tokens "^3.0.0"
|
||||
|
||||
loud-rejection@^1.0.0:
|
||||
loud-rejection@^1.0.0, loud-rejection@^1.6.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
|
||||
dependencies:
|
||||
|
@ -6033,7 +6046,7 @@ micromatch@^2.1.5, micromatch@^2.3.11:
|
|||
parse-glob "^3.0.4"
|
||||
regex-cache "^0.4.2"
|
||||
|
||||
micromatch@^3.1.4, micromatch@^3.1.8:
|
||||
micromatch@^3.1.4, micromatch@^3.1.8, micromatch@^3.1.9:
|
||||
version "3.1.10"
|
||||
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23"
|
||||
dependencies:
|
||||
|
@ -6072,9 +6085,9 @@ mime@1.4.1:
|
|||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.4.1.tgz#121f9ebc49e3766f311a76e1fa1c8003c4b03aa6"
|
||||
|
||||
mime@^1.5.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1"
|
||||
mime@^2.1.0:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-2.3.1.tgz#b1621c54d63b97c47d3cfe7f7215f7d64517c369"
|
||||
|
||||
mimic-fn@^1.0.0:
|
||||
version "1.2.0"
|
||||
|
@ -6600,10 +6613,6 @@ obuf@^1.0.0, obuf@^1.1.1:
|
|||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e"
|
||||
|
||||
on-build-webpack@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/on-build-webpack/-/on-build-webpack-0.1.0.tgz#a287c0e17766e6141926e5f2cbb0d8bb53b76814"
|
||||
|
||||
on-finished@~2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
|
||||
|
@ -9001,10 +9010,6 @@ ticky@1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/ticky/-/ticky-1.0.0.tgz#e87f38ee0491ea32f62e8f0567ba9638b29f049c"
|
||||
|
||||
time-stamp@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-2.0.0.tgz#95c6a44530e15ba8d6f4a3ecb8c3a3fac46da357"
|
||||
|
||||
timers-browserify@^2.0.4:
|
||||
version "2.0.10"
|
||||
resolved "https://registry.yarnpkg.com/timers-browserify/-/timers-browserify-2.0.10.tgz#1d28e3d2aadf1d5a5996c4e9f95601cd053480ae"
|
||||
|
@ -9352,6 +9357,10 @@ urix@^0.1.0, urix@~0.1.0:
|
|||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72"
|
||||
|
||||
url-join@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.0.tgz#4d3340e807d3773bda9991f8305acdcc2a665d2a"
|
||||
|
||||
url-parse@1.0.x:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.0.5.tgz#0854860422afdcfefeb6c965c662d4800169927b"
|
||||
|
@ -9537,19 +9546,21 @@ webpack-cli@^3.0.3:
|
|||
v8-compile-cache "^2.0.0"
|
||||
yargs "^11.1.0"
|
||||
|
||||
webpack-dev-middleware@1.12.2:
|
||||
version "1.12.2"
|
||||
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-1.12.2.tgz#f8fc1120ce3b4fc5680ceecb43d777966b21105e"
|
||||
webpack-dev-middleware@3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/webpack-dev-middleware/-/webpack-dev-middleware-3.1.3.tgz#8b32aa43da9ae79368c1bf1183f2b6cf5e1f39ed"
|
||||
dependencies:
|
||||
loud-rejection "^1.6.0"
|
||||
memory-fs "~0.4.1"
|
||||
mime "^1.5.0"
|
||||
mime "^2.1.0"
|
||||
path-is-absolute "^1.0.0"
|
||||
range-parser "^1.0.3"
|
||||
time-stamp "^2.0.0"
|
||||
url-join "^4.0.0"
|
||||
webpack-log "^1.0.1"
|
||||
|
||||
webpack-dev-server@^2.11.1:
|
||||
version "2.11.2"
|
||||
resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-2.11.2.tgz#1f4f4c78bf1895378f376815910812daf79a216f"
|
||||
webpack-dev-server@^3.1.4:
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.1.4.tgz#9a08d13c4addd1e3b6d8ace116e86715094ad5b4"
|
||||
dependencies:
|
||||
ansi-html "0.0.7"
|
||||
array-includes "^3.0.3"
|
||||
|
@ -9561,7 +9572,7 @@ webpack-dev-server@^2.11.1:
|
|||
del "^3.0.0"
|
||||
express "^4.16.2"
|
||||
html-entities "^1.2.0"
|
||||
http-proxy-middleware "~0.17.4"
|
||||
http-proxy-middleware "~0.18.0"
|
||||
import-local "^1.0.0"
|
||||
internal-ip "1.2.0"
|
||||
ip "^1.1.5"
|
||||
|
@ -9576,8 +9587,18 @@ webpack-dev-server@^2.11.1:
|
|||
spdy "^3.4.1"
|
||||
strip-ansi "^3.0.0"
|
||||
supports-color "^5.1.0"
|
||||
webpack-dev-middleware "1.12.2"
|
||||
yargs "6.6.0"
|
||||
webpack-dev-middleware "3.1.3"
|
||||
webpack-log "^1.1.2"
|
||||
yargs "11.0.0"
|
||||
|
||||
webpack-log@^1.0.1, webpack-log@^1.1.2:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/webpack-log/-/webpack-log-1.2.0.tgz#a4b34cda6b22b518dbb0ab32e567962d5c72a43d"
|
||||
dependencies:
|
||||
chalk "^2.1.0"
|
||||
log-symbols "^2.1.0"
|
||||
loglevelnext "^1.0.1"
|
||||
uuid "^3.1.0"
|
||||
|
||||
webpack-sources@^1.0.1, webpack-sources@^1.1.0:
|
||||
version "1.1.0"
|
||||
|
@ -9765,12 +9786,6 @@ yallist@^3.0.0, yallist@^3.0.2:
|
|||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"
|
||||
|
||||
yargs-parser@^4.2.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"
|
||||
dependencies:
|
||||
camelcase "^3.0.0"
|
||||
|
||||
yargs-parser@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a"
|
||||
|
@ -9783,25 +9798,7 @@ yargs-parser@^9.0.2:
|
|||
dependencies:
|
||||
camelcase "^4.1.0"
|
||||
|
||||
yargs@6.6.0:
|
||||
version "6.6.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.6.0.tgz#782ec21ef403345f830a808ca3d513af56065208"
|
||||
dependencies:
|
||||
camelcase "^3.0.0"
|
||||
cliui "^3.2.0"
|
||||
decamelize "^1.1.1"
|
||||
get-caller-file "^1.0.1"
|
||||
os-locale "^1.4.0"
|
||||
read-pkg-up "^1.0.1"
|
||||
require-directory "^2.1.1"
|
||||
require-main-filename "^1.0.1"
|
||||
set-blocking "^2.0.0"
|
||||
string-width "^1.0.2"
|
||||
which-module "^1.0.0"
|
||||
y18n "^3.2.1"
|
||||
yargs-parser "^4.2.0"
|
||||
|
||||
yargs@^11.0.0:
|
||||
yargs@11.0.0, yargs@^11.0.0:
|
||||
version "11.0.0"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.0.0.tgz#c052931006c5eee74610e5fc0354bedfd08a201b"
|
||||
dependencies:
|
||||
|
|
Loading…
Reference in New Issue