Skip to content

Commit

Permalink
Merge pull request #2012 from benderl/cards-display
Browse files Browse the repository at this point in the history
remove console output in production build
  • Loading branch information
benderl authored Nov 12, 2024
2 parents 8d62b80 + f1780c9 commit 7798bfd
Show file tree
Hide file tree
Showing 3 changed files with 180 additions and 24 deletions.
189 changes: 167 additions & 22 deletions packages/modules/display_themes/cards/source/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/modules/display_themes/cards/source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"vue-router": "^4.4.5"
},
"devDependencies": {
"@rollup/plugin-terser": "^0.4.4",
"@rushstack/eslint-patch": "^1.10.4",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/eslint-config-prettier": "^9.0.0",
Expand Down
14 changes: 12 additions & 2 deletions packages/modules/display_themes/cards/source/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import Vue from "@vitejs/plugin-vue";

import { nodePolyfills } from "vite-plugin-node-polyfills";
import rollupNodePolyfills from "rollup-plugin-polyfill-node";
import terser from '@rollup/plugin-terser';


// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
Expand All @@ -19,7 +21,7 @@ export default defineConfig(({ command, mode }) => {
};
if (command === "serve") {
if (mode === "test") {
myConfiguration["test"] = {
myConfiguration.test = {
globals: true,
environment: "jsdom",
};
Expand Down Expand Up @@ -48,7 +50,15 @@ export default defineConfig(({ command, mode }) => {
);
myConfiguration.build = {
rollupOptions: {
plugins: [rollupNodePolyfills()],
plugins: [
rollupNodePolyfills(),
mode === "production" ? terser({
compress: {
drop_console: true,
pure_funcs: ['console.debug', 'console.info', 'console.log'],
},
}) : null,
],
output: {
manualChunks(id) {
if (id.includes("node_modules")) {
Expand Down

0 comments on commit 7798bfd

Please sign in to comment.