Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit c4918fb

Browse files
fix(collectors): add require string check
1 parent 5661223 commit c4918fb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/collectors.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ export const setters = function () {
1616
}
1717

1818
export const requires = function () {
19-
config.require.forEach(value => _require(value))
19+
config.require.forEach(value => {
20+
if (typeof value !== 'string') {
21+
throw new Error(
22+
'[vue-analytics] Wrong configuration in the plugin options. \n' +
23+
'The "require" array requires each item to be a string.'
24+
)
25+
}
26+
27+
_require(value)
28+
})
2029
}
2130

2231
export default function () {

0 commit comments

Comments
 (0)