chrome-extension-webpack-boilerplate icon indicating copy to clipboard operation
chrome-extension-webpack-boilerplate copied to clipboard

not work for content.js in chrome 66

Open lessfish opened this issue 6 years ago • 2 comments

this repo is awesome! and it works quite fine with popup.js, bg.js, but it may not work in content.js in chrome 66, I am not sure if it's an issue of chrome or this repo, when i include a content.js file, after the file modified, I should refresh the certain extension in the page chrome://extensions/, some days ago reloading the page chrome://extensions/ is enough

lessfish avatar Apr 24 '18 07:04 lessfish

nobody?

lessfish avatar May 24 '18 04:05 lessfish

I just noticed the same problem, the problem is that the webpack config isn't set up to include the additional content script during build.

I got it to work by adding the content script to wepack.config.js on line 26:

entry: {
    popup: path.join(__dirname, "src", "js", "popup.js"),
    options: path.join(__dirname, "src", "js", "options.js"),
    background: path.join(__dirname, "src", "js", "background.js"),
    content: path.join(__dirname, "src", "js", "content.js")
}

Note that by defauly webpack will use the filename content.bundle.js, so I just used that filename in manifest.json:

"content_scripts": [{
    "matches": ["*://*.stackoverflow.com/*"],
    "js": ["content.bundle.js"]
}]

nickforddev avatar Aug 15 '18 16:08 nickforddev