adambullmer / vue-cli-plugin-browser-extension

Browser extension development plugin for vue-cli 3.0
GNU Lesser General Public License v3.0
427 stars 76 forks source link

Hot reloading not working for content scripts #36

Closed stigvanbrabant closed 5 years ago

stigvanbrabant commented 5 years ago

The hot reloading seems to work when using the popup, but i can't get it to work with content scripts. I always need to manually reload the extension, any known solutions?

franciscolourenco commented 5 years ago

@stigvanbrabant which browser are you using?

stigvanbrabant commented 5 years ago

@franciscolourenco I'm using google chrome (76.0.3809.46 beta)

adambullmer commented 5 years ago

HMR is not supported at this time. It is a limitation of https://github.com/rubenspgcavalcante/webpack-chrome-extension-reloader and https://github.com/rubenspgcavalcante/webpack-extension-reloader

There isn't really a workaround, other than manually refreshing the page or closing & reopening the popup. Also not ideal, but you could prototype UI work in a more typical vue application setup, and then incorporate into your extension once it's ready for use in there.

adambullmer commented 5 years ago

closing due to inactivity

zs-jakob commented 4 years ago

Your last suggestion seems like a good one. How do I add the standard VUE-CLI hot reload support to a project with this plugin so I can serve static/index.html as usual? Wondering what the easiest way would be.

Thank you for making this plugin available 👍

zs-jakob commented 4 years ago

I think I got it working. Ran vue-cli-service serve and had to add a config to vue.config.js for Webpack's HTML plugin for it to work and render titles correctly.

  chainWebpack: (config) => {
    config
      .plugin('html')
      .tap(args => {
        args[0].title = 'App title'
        return args
      })
  },

In src/main.js:

import App from './components/myApp.vue'

zs-jakob commented 4 years ago

There's one issue – I keep getting these errors since I'm loading it from index.html and not as an extension. Any suggestions?

image

franciscolourenco commented 4 years ago

You are trying to load background.js in a normal tab?

zs-jakob commented 4 years ago

It happens when I run vue-cli service. I need to modify the webpack config not to include background.js when I run it for standalone use (served as a regular app). Pointers are most welcome.