From a7601f7aa493db5d96b66fbbf79e92ff54c4ff28 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 15 Feb 2018 23:07:19 +0900 Subject: [PATCH] wip --- package.json | 2 ++ webpack/module/rules/base64.ts | 14 ++++++------- webpack/module/rules/collapse-spaces.ts | 23 ++++++++++---------- webpack/module/rules/fa.ts | 12 +++++------ webpack/module/rules/i18n.ts | 12 +++++------ webpack/module/rules/index.ts | 8 +++---- webpack/module/rules/theme-color.ts | 26 ----------------------- webpack/module/rules/vue.ts | 28 ++++++++++++++++++++----- 8 files changed, 55 insertions(+), 70 deletions(-) delete mode 100644 webpack/module/rules/theme-color.ts diff --git a/package.json b/package.json index bf924dcdb0..06e517a0d1 100644 --- a/package.json +++ b/package.json @@ -157,6 +157,7 @@ "serve-favicon": "2.4.5", "sortablejs": "1.7.0", "speakeasy": "2.0.0", + "string-replace-loader": "^1.3.0", "string-replace-webpack-plugin": "0.1.3", "style-loader": "0.20.1", "stylus": "0.54.5", @@ -182,6 +183,7 @@ "vue-template-compiler": "^2.5.13", "web-push": "3.2.5", "webpack": "3.10.0", + "webpack-replace-loader": "^1.3.0", "websocket": "1.0.25", "xev": "2.0.0" } diff --git a/webpack/module/rules/base64.ts b/webpack/module/rules/base64.ts index 886f0e8b38..c2f6b9339e 100644 --- a/webpack/module/rules/base64.ts +++ b/webpack/module/rules/base64.ts @@ -8,13 +8,11 @@ export default () => ({ enforce: 'pre', test: /\.(vue|js)$/, exclude: /node_modules/, - use: [{ - loader: 'replace-string-loader', - options: { - search: /%base64:(.+?)%/g, - replace: (_, key) => { - return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64'); - } + loader: 'string-replace-loader', + query: { + search: /%base64:(.+?)%/g, + replace: (_, key) => { + return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64'); } - }] + } }); diff --git a/webpack/module/rules/collapse-spaces.ts b/webpack/module/rules/collapse-spaces.ts index 48fd57f017..734c735926 100644 --- a/webpack/module/rules/collapse-spaces.ts +++ b/webpack/module/rules/collapse-spaces.ts @@ -1,20 +1,19 @@ import * as fs from 'fs'; const minify = require('html-minifier').minify; -const StringReplacePlugin = require('string-replace-webpack-plugin'); export default () => ({ enforce: 'pre', test: /\.vue$/, exclude: /node_modules/, - loader: StringReplacePlugin.replace({ - replacements: [{ - pattern: /^