summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--webpack.config.ts25
-rw-r--r--webpack/loaders/replace.js30
2 files changed, 1 insertions, 54 deletions
diff --git a/webpack.config.ts b/webpack.config.ts
index 7d1f914c4e..ee1b59c950 100644
--- a/webpack.config.ts
+++ b/webpack.config.ts
@@ -6,7 +6,6 @@ import * as fs from 'fs';
import * as webpack from 'webpack';
import chalk from 'chalk';
const { VueLoaderPlugin } = require('vue-loader');
-const minifyHtml = require('html-minifier').minify;
const WebpackOnBuildPlugin = require('on-build-webpack');
//const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
@@ -18,20 +17,6 @@ const meta = require('./package.json');
const version = meta.clientVersion;
const codename = meta.codename;
-declare var global: {
- collapseSpacesReplacement: any;
-};
-
-//#region Replacer definitions
-global['collapseSpacesReplacement'] = (html: string) => {
- return minifyHtml(html, {
- collapseWhitespace: true,
- collapseInlineTagWhitespace: true,
- keepClosingSlash: true
- }).replace(/\t/g, '');
-};
-//#endregion
-
const langs = Object.keys(locales);
const isProduction = process.env.NODE_ENV == 'production';
@@ -122,14 +107,6 @@ module.exports = {
}
}, {
loader: 'vue-svg-inline-loader'
- }, {
- loader: 'replace',
- query: {
- qs: [{
- search: /^<template>([\s\S]+?)\r?\n<\/template>/.toString(),
- replace: 'collapseSpacesReplacement'
- }]
- }
}]
}, {
test: /\.styl(us)?$/,
@@ -199,7 +176,7 @@ module.exports = {
}
},
resolveLoader: {
- modules: ['node_modules', './webpack/loaders']
+ modules: ['node_modules']
},
cache: true,
devtool: false, //'source-map',
diff --git a/webpack/loaders/replace.js b/webpack/loaders/replace.js
deleted file mode 100644
index 9f4825e18c..0000000000
--- a/webpack/loaders/replace.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import { getOptions } from 'loader-utils';
-
-function trim(text, g) {
- return text.substring(1, text.length - (g ? 2 : 0));
-}
-
-export default function(src) {
- const fn = options => {
- const search = options.search;
- const g = search.endsWith('g');
- const file = this.resourcePath.replace(/\\/g, '/');
- const replace = options.i18n ? global[options.replace].bind(null, {
- src: file,
- lang: options.lang
- }) : global[options.replace];
- if (typeof search != 'string' || search.length == 0) console.error('invalid search');
- if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
- src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);
- };
-
- this.cacheable();
- const options = getOptions(this);
- if (options.qs) {
- options.qs.forEach(q => fn(q));
- } else {
- fn(options);
- }
- this.callback(null, src);
- return src;
-}