Skip to content

Commit

Permalink
webpack5 (#1140)
Browse files Browse the repository at this point in the history
* webpack5

* bye progress-bar-webpack-plugin など

* cache

* bye terser
  • Loading branch information
mei23 committed May 5, 2020
1 parent afd81c5 commit a33c921
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 764 deletions.
4 changes: 0 additions & 4 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as rimraf from 'rimraf';
import * as chalk from 'chalk';
import * as rename from 'gulp-rename';
import * as replace from 'gulp-replace';
const terser = require('gulp-terser');
const cleanCSS = require('gulp-clean-css');

const locales = require('./locales');
Expand Down Expand Up @@ -85,9 +84,6 @@ gulp.task('build:client:script', () => {
.pipe(replace('VERSION', JSON.stringify(client.version)))
.pipe(replace('ENV', JSON.stringify(env)))
.pipe(replace('LANGS', JSON.stringify(Object.keys(locales))))
.pipe(terser({
toplevel: true
}))
.pipe(gulp.dest('./built/client/assets/'));
});

Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@
"gulp-replace": "1.0.0",
"gulp-sourcemaps": "2.6.5",
"gulp-stylus": "2.7.0",
"gulp-terser": "1.2.0",
"gulp-tslint": "8.1.4",
"gulp-typescript": "5.0.1",
"hard-source-webpack-plugin": "0.13.1",
"html-minifier": "4.0.0",
"htmlescape": "1.1.1",
"http-proxy-agent": "4.0.1",
Expand Down Expand Up @@ -170,7 +168,6 @@
"postcss-loader": "3.0.0",
"prismjs": "1.20.0",
"probe-image-size": "5.0.0",
"progress-bar-webpack-plugin": "2.1.0",
"promise-limit": "2.7.0",
"promise-sequential": "1.1.1",
"pug": "2.0.4",
Expand Down Expand Up @@ -198,7 +195,6 @@
"summaly": "2.3.1",
"systeminformation": "4.24.1",
"syuilo-password-strength": "0.0.1",
"terser-webpack-plugin": "2.3.6",
"textarea-caret": "3.1.0",
"three": "0.116.1",
"tinycolor2": "1.4.1",
Expand Down Expand Up @@ -231,7 +227,7 @@
"vuex": "3.3.0",
"vuex-persistedstate": "3.0.1",
"web-push": "3.4.3",
"webpack": "4.43.0",
"webpack": "5.0.0-beta.15",
"webpack-cli": "3.3.11",
"websocket": "1.0.31",
"ws": "7.2.5",
Expand Down
19 changes: 9 additions & 10 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@

import * as fs from 'fs';
import * as webpack from 'webpack';
import * as chalk from 'chalk';
import rndstr from 'rndstr';
const { VueLoaderPlugin } = require('vue-loader');
//const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');

class WebpackOnBuildPlugin {
constructor(readonly callback: (stats: any) => void) {
Expand Down Expand Up @@ -124,10 +120,7 @@ module.exports = {
},
plugins: [
//new HardSourceWebpackPlugin(),
new ProgressBarPlugin({
format: chalk` {cyan.bold yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray (:current/:total)} :elapseds`,
clear: false
}),
new webpack.ProgressPlugin({}),
new webpack.DefinePlugin({
_CONSTANTS_: JSON.stringify(constants),
_VERSION_: JSON.stringify(version),
Expand Down Expand Up @@ -159,16 +152,22 @@ module.exports = {
'.js', '.ts', '.json'
],
alias: {
'crypto': false,
'const.styl': __dirname + '/src/client/const.styl'
}
},
resolveLoader: {
modules: ['node_modules']
},
optimization: {
minimizer: [new TerserPlugin()]
minimize: false
},
cache: {
type: 'filesystem',
buildDependencies: {
config: [__filename]
}
},
cache: true,
devtool: false, //'source-map',
mode: isProduction ? 'production' : 'development'
};

0 comments on commit a33c921

Please sign in to comment.