From dd85278d54e7bef392e44ccf22cf49fe595a36d6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 23 Nov 2017 06:51:32 +0900 Subject: Fix bug --- webpack/module/rules/consts.ts | 41 ----------------------------------------- webpack/module/rules/index.ts | 2 -- 2 files changed, 43 deletions(-) delete mode 100644 webpack/module/rules/consts.ts (limited to 'webpack/module') diff --git a/webpack/module/rules/consts.ts b/webpack/module/rules/consts.ts deleted file mode 100644 index 7f66106213..0000000000 --- a/webpack/module/rules/consts.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Replace consts - */ - -const StringReplacePlugin = require('string-replace-webpack-plugin'); - -import version from '../../../src/version'; -const constants = require('../../../src/const.json'); -import config from '../../../src/conf'; - -export default lang => { - // 置換の誤爆を防ぐため文字数の多い順に並べてください - const consts = { - _RECAPTCHA_SITEKEY_: JSON.stringify(config.recaptcha.site_key), - _SW_PUBLICKEY_: config.sw ? JSON.stringify(config.sw.public_key) : JSON.stringify(null), - _THEME_COLOR_: JSON.stringify(constants.themeColor), - _VERSION_: JSON.stringify(version), - _STATUS_URL_: JSON.stringify(config.status_url), - _STATS_URL_: JSON.stringify(config.stats_url), - _ABOUT_URL_: JSON.stringify(config.about_url), - _API_URL_: JSON.stringify(config.api_url), - _DEV_URL_: JSON.stringify(config.dev_url), - _CH_URL_: JSON.stringify(config.ch_url), - _LANG_: JSON.stringify(lang), - _HOST_: JSON.stringify(config.host), - _URL_: JSON.stringify(config.url), - }; - - const replacements = Object.keys(consts).map(key => ({ - pattern: new RegExp(key, 'g'), replacement: () => consts[key] - })); - - return { - enforce: 'post', - test: /\.(tag|js|ts)$/, - exclude: /node_modules/, - loader: StringReplacePlugin.replace({ - replacements: replacements - }) - }; -}; diff --git a/webpack/module/rules/index.ts b/webpack/module/rules/index.ts index 0006f622d2..9c1262b3d6 100644 --- a/webpack/module/rules/index.ts +++ b/webpack/module/rules/index.ts @@ -1,5 +1,4 @@ import i18n from './i18n'; -import consts from './consts'; import base64 from './base64'; import themeColor from './theme-color'; import tag from './tag'; @@ -8,7 +7,6 @@ import typescript from './typescript'; export default (lang, locale) => [ i18n(lang, locale), - consts(lang), base64(), themeColor(), tag(), -- cgit v1.2.3-freya