vue-cli-plugin-browser-extension
vue-cli-plugin-browser-extension copied to clipboard
Configuring multiple background scripts gives error
Describe the bug According to the documentation we should be able to have an array of background scripts like below
pluginOptions: {
browserExtension: {
componentOptions: {
background: {
entry: ['src/background.js', 'src/background.test-harness.js']
},
contentScripts: {
entries: {
'content-script': [
'src/content-scripts/content-script.js',
'src/content-scripts/block-content.js',
]
}
}
}
}
}
This however does not properly build with vue-cli-service build --mode development --watch
as seen below
ERROR TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array
Any idea why this is the case?
@Pithikos this is what I have in my vue.config.js and it works well (sorry for the formatting):
module.exports = { lintOnSave: false, pages: { popup: { template: "public/browser-extension.html", entry: "./src/popup/main.js", title: "Popup" } }, pluginOptions: { browserExtension: { componentOptions: { background: { entry: "src/background.js" }, contentScripts: { entries: { page: 'src/content-scripts/page.js', device: 'src/content-scripts/device.js', } } } } } };
Same problem, my vue.config.js:
lintOnSave: false,
pages: {
standalone: {
template: 'public/browser-extension.html',
entry: './src/standalone/main.js',
title: 'Standalone',
filename: 'index.html'
}
},
pluginOptions: {
browserExtension: {
componentOptions: {
background: {
entry: ['src/background.js', 'src/axios.min.js']
}
}
}
},
}
Error:
ERROR TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array