fix: bundle the content script to stop 'Unsafe attempt to load URL' errors

Dynamic import() of extension modules from a content script makes Chrome log
'Unsafe attempt to load URL chrome-extension://...' on YouTube pages, which fills
the extension's error list even though the modules load (HTTP 200). The content
script is now one classic file built by 'npm run build'; web_accessible_resources
is no longer needed and is removed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
IgorVolochay
2026-10-25 12:25:06 +03:00
co-authored by Claude Sonnet 5.5
parent 38dabd9fa2
commit b137776381
9 changed files with 461 additions and 61 deletions
+9 -1
View File
@@ -24,10 +24,18 @@
## Разработка
Сборки нет. Тесты (Node 22, без зависимостей; тест разбора карточки запускает headless Chrome и пропускается, если Chrome не найден):
Зависимостей нет, сборка только одна (content script, см. ниже). Тесты (Node 22; тест разбора карточки запускает headless Chrome и пропускается, если Chrome не найден):
```
npm test
```
Content script собирается в один файл: после правки `src/content/main.js` или модулей из `src/lib/`, которые он использует (`card`, `numbers`, `vidiq`, `video-id`), выполните
```
npm run build
```
Собранный `src/content.js` лежит в репозитории, тест `bundle` падает, если он отстал от исходников. Динамический `import()` в content script не используется: Chrome оставляет из-за него ошибки в `chrome://extensions`.
После изменения кода нажмите «Обновить» у расширения на `chrome://extensions`.