my vue component:
<script>
import debug from 'debug'
const log = debug('app:logging')
export default {
...
created(){
log('testing logging');
}
...
}
<script>
$env:DEBUG='app:*'; npm run serveset DEBUG=app:* & npm run serve[dotenv][DEBUG] "DEBUG" is already defined in "process.env" and will not be overwrittenWhat should I do to get this working corectly? I would like to see the message testing logging in console.
I'm new to web developing. I'm using webpack. I set the localstorage in code and chcek the DevTools. But still dont see the message. Could you point me where/how to set the localstorage correcly so it is working.
We use this in our Vue projects, in whatever js file is your main entry point
import debug from 'debug'
const log = debug('app')
if (config.get('isLocal')) {
debug.enable('app*,store*,module*,utility*')
log('Initialized App')
}
The if statement is optional, we just only run debug if our config is set to dev mode.
Just set debug item of localstorage and refresh your page, for example, see the following snapshot.

Most helpful comment
We use this in our Vue projects, in whatever js file is your main entry point
The if statement is optional, we just only run
debugif our config is set to dev mode.