tommy44458 / mqtt-vue-hook

Mqtt-Vue-hook is a TypeScript library that makes it easy to connect to an MQTT broker (supports v5) and manages callback functions for various topics.
https://www.npmjs.com/package/mqtt-vue-hook
MIT License
24 stars 3 forks source link

Console Log on reconnect show config mqtt #5

Closed ridhansholeh closed 2 years ago

ridhansholeh commented 2 years ago

hello i see in my browser console its showing config mqtt such as username, password, etc. when try to reconnect. how to disable this console log on production server?

tommy44458 commented 2 years ago

Hi @ridhansholeh,

Do you build your web environment by Vite? If yes, you can try to add the following code in your "vite.config.ts":

export default (...) => {
    return defineConfig({
        ...,
        build: {
            ...
            terserOptions: {
                compress: {
                    drop_console: ENV.VITE_BUILD_DROP_CONSOLE === TRUE,
                    // disable console in prod.env
                    drop_debugger: ENV.VITE_BUILD_DROP_DEBUGGER === TRUE,
                     // disable debug in prod.env
                },
            },
        },
    })
}

For Webpack, maybe the plugin can help you: https://www.npmjs.com/package/remove-console-webpack-plugin