Remove consoles in prod

This commit is contained in:
Lim Chee Aun 2023-01-02 15:09:31 +08:00
parent c3aef80ad4
commit c2bf9eabc5
3 changed files with 16 additions and 0 deletions

13
package-lock.json generated
View file

@ -37,6 +37,7 @@
"vite-plugin-html-config": "~1.0.11", "vite-plugin-html-config": "~1.0.11",
"vite-plugin-html-env": "~1.2.7", "vite-plugin-html-env": "~1.2.7",
"vite-plugin-pwa": "~0.14.0", "vite-plugin-pwa": "~0.14.0",
"vite-plugin-remove-console": "~1.3.0",
"workbox-cacheable-response": "~6.5.4", "workbox-cacheable-response": "~6.5.4",
"workbox-expiration": "~6.5.4", "workbox-expiration": "~6.5.4",
"workbox-routing": "~6.5.4", "workbox-routing": "~6.5.4",
@ -5471,6 +5472,12 @@
"workbox-window": "^6.5.4" "workbox-window": "^6.5.4"
} }
}, },
"node_modules/vite-plugin-remove-console": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/vite-plugin-remove-console/-/vite-plugin-remove-console-1.3.0.tgz",
"integrity": "sha512-5a/OLYB6yNRHMuHj9rBQRYMQ1NBKffxA8BaD77urUBLcGOWMHFHALjh6C26wZfZd41KytSwLp6DhvNKU78mNJg==",
"dev": true
},
"node_modules/webidl-conversions": { "node_modules/webidl-conversions": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
@ -9679,6 +9686,12 @@
"workbox-window": "^6.5.4" "workbox-window": "^6.5.4"
} }
}, },
"vite-plugin-remove-console": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/vite-plugin-remove-console/-/vite-plugin-remove-console-1.3.0.tgz",
"integrity": "sha512-5a/OLYB6yNRHMuHj9rBQRYMQ1NBKffxA8BaD77urUBLcGOWMHFHALjh6C26wZfZd41KytSwLp6DhvNKU78mNJg==",
"dev": true
},
"webidl-conversions": { "webidl-conversions": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",

View file

@ -39,6 +39,7 @@
"vite-plugin-html-config": "~1.0.11", "vite-plugin-html-config": "~1.0.11",
"vite-plugin-html-env": "~1.2.7", "vite-plugin-html-env": "~1.2.7",
"vite-plugin-pwa": "~0.14.0", "vite-plugin-pwa": "~0.14.0",
"vite-plugin-remove-console": "~1.3.0",
"workbox-cacheable-response": "~6.5.4", "workbox-cacheable-response": "~6.5.4",
"workbox-expiration": "~6.5.4", "workbox-expiration": "~6.5.4",
"workbox-routing": "~6.5.4", "workbox-routing": "~6.5.4",

View file

@ -6,6 +6,7 @@ import { defineConfig, loadEnv, splitVendorChunkPlugin } from 'vite';
import htmlPlugin from 'vite-plugin-html-config'; import htmlPlugin from 'vite-plugin-html-config';
import VitePluginHtmlEnv from 'vite-plugin-html-env'; import VitePluginHtmlEnv from 'vite-plugin-html-env';
import { VitePWA } from 'vite-plugin-pwa'; import { VitePWA } from 'vite-plugin-pwa';
import removeConsole from 'vite-plugin-remove-console';
const { NODE_ENV } = process.env; const { NODE_ENV } = process.env;
const { VITE_CLIENT_NAME: CLIENT_NAME, VITE_APP_ERROR_LOGGING: ERROR_LOGGING } = const { VITE_CLIENT_NAME: CLIENT_NAME, VITE_APP_ERROR_LOGGING: ERROR_LOGGING } =
@ -29,6 +30,7 @@ export default defineConfig({
preact(), preact(),
splitVendorChunkPlugin(), splitVendorChunkPlugin(),
VitePluginHtmlEnv(), VitePluginHtmlEnv(),
removeConsole(),
htmlPlugin({ htmlPlugin({
headScripts: ERROR_LOGGING ? [rollbarCode] : [], headScripts: ERROR_LOGGING ? [rollbarCode] : [],
}), }),