Skip to content

Repository files navigation

img

Warning

This is an early version of an experimental plugin with many bugs.
Do not actually use it.

Warning

MacOS only

Warning

Will patch webpack-log to allow empty logGrup names

Warning

The python script needs:
pip install pyaudio termcolor pydub simpleaudio elevenlabs

The Swift binary for showing popups is included.

Rebuild with:

swiftc ErrorPopup.swift -o ErrorPopup

Test with:

./ErrorPopup 'Compilation failed' \
  '45 |      }\\n46 |    }\\n47 |    props: {\\n   |    ^\\n48 |      connectivity: Boolean,\\n49 |      title: String,' \
  'BasicHeader.vue needs a comma on line 47 near props' \
  'BasicHeader.vue' \
  '/Users/whomstve/projects/nzt48/src/components/ui/header' \
  20

Configuration

const WebpackErrorFormatterPlugin = require('error-helper-webpack-plugin/WebpackErrorFormatterPlugin.js')
/** @import {WebpackErrorFormatterPluginConf} from 'error-helper-webpack-plugin' */

  webpack.chainWebpack((config) => {
    /** @type {WebpackErrorFormatterPluginConf} */
    const errorHelperConfig = {
      // Ask AI to figure out what the issue is:
      analyzer: {
        active: true,
        engine: 'OpenAI'
        // apiKey: '...', // TODO: configurable api key or env var name
        // (!) currently needs OPENAI_API_KEY env variable available to python
      },

      // Pipe it to TTS:
      tts: {
        active: true,
        engine: 'ElevenLabs', // 'ElevenLabs' needs an API key | 'local' uses "say 'What to say.'" builtin TTS engine on MacOS
        voiceId: '5izH2Qlr4ky45aDBTZE1', // Copy from Elevenlabs Voice details page
        apiKey: 'sk_000000000000000000000000000000000000000000000000' // from https://elevenlabs.io/app/settings/api-keys
        /* Setting these environment variables
           ELEVENLABS_API_KEY="..."
           ELEVENLABS_VOICE_ID="..."
           in the default Python env will also work
        */
      },

      log: { level: 'trace' },
      bail: true, // Stop compilation with process.exit
      debug: true, // Print more stuff
      popup: 5 // seconds, remove to disable the popup
    }
    
    config.plugin('WebpackErrorFormatterPlugin').use(WebpackErrorFormatterPlugin, [errorHelperConfig])
  })

Or

  plugins: [
    // ... Other plugins,
    new WebpackErrorFormatterPlugin(errorHelperConfig)
  ]

About

Show Webpack errors in system popups and read them out loud with text-to-speech

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages