Skip to content

Commit df28110

Browse files
authored
Merge pull request #26 from sanyu1225/feature
fix: issue-24 Service workers have to be in root directory #24
2 parents 33dc5cb + 97ac5a9 commit df28110

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

generator/generate/manifest.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ const generateManifest = (options, manifestPath) => {
2323
}
2424
const mf3_content = {
2525
'background': {
26-
'service_worker': '/js/background.js'
26+
'service_worker': '/background.js'
2727
},
2828
'action': {
2929
'default_popup': 'popup.html'
3030
},
3131
'content_scripts': [{
3232
'matches': ['<all_urls>'],
33-
'js': ['/js/content.js']
33+
'js': ['/content.js']
3434
}],
3535
'options_page': 'options.html',
3636
'devtools_page': 'devtools.html'
3737
}
3838
const mf2_content = {
3939
'background': {
40-
'scripts': ['/js/background.js'],
40+
'scripts': ['/background.js'],
4141
'persistent': false
4242
},
4343
'browser_action': { default_popup: 'popup.html' },
4444
'content_scripts': [{
4545
'matches': ['<all_urls>'],
46-
'js': ['/js/content.js']
46+
'js': ['/content.js']
4747
}],
4848
'options_page': 'options.html',
4949
'devtools_page': 'devtools.html'
@@ -56,13 +56,6 @@ const generateManifest = (options, manifestPath) => {
5656
components.forEach(element => {
5757
prodJSON[mf3_Key[element]] = mf3_content[mf3_Key[element]]
5858
devJSON[mf3_Key[element]] = mf3_content[mf3_Key[element]]
59-
if (element === 'content') {
60-
prodJSON['content_scripts'] = [{
61-
'matches': ['<all_urls>'],
62-
'js': ['/js/content.js'],
63-
'css': ['/js/content.css']
64-
}]
65-
}
6659
})
6760
} else {
6861
components.forEach(element => {

generator/template/vue.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ module.exports = {
4343
},
4444
configureWebpack: {
4545
output: {
46-
filename: `js/[name].js`,
46+
filename: `[name].js`,
4747
chunkFilename: `[name].js`
4848
},
4949
devtool: isDevMode ? 'inline-source-map' : false
50+
},
51+
css: {
52+
extract: false // Make sure the css is the same
5053
}
5154
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-plugin-chrome-extension-cli",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Use Vue CLI generate chrome extension template | generate chrome extension with vue.js",
55
"author": "sanyu1225 <pan831225@gmail.com>",
66
"scripts": {},

0 commit comments

Comments
 (0)