...
vite v5.1.0 building for development...
✓ 1 modules transformed.
dist/src/index.css 26.42 kB │ gzip: 4.85 kB
✓ built in 186ms
undefined:1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
^
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
at JSON.parse (<anonymous>)
at IncomingMessage.<anonymous> (file:///path/to/project/node_modules/.pnpm/vite-plugin-web-extension@4.1.1/node_modules/vite-plugin-web-extension/dist/index.js:949:20)
at IncomingMessage.emit (node:events:530:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Node.js v20.11.0
The code near vite-plugin-web-extension/dist/index.js:949:20:
...
async function loadSchema() {
if (schema != null)
return;
logger.verbose(`Loading JSON schema from ${SCHEMA_URL.href}...`);
schema = await get(SCHEMA_URL.href);
}
function get(url) {
return new Promise((res, rej) => {
https.get(url, (response) => {
let responseBody = "";
response.on("data", (chunk) => {
responseBody += chunk;
});
response.on("end", () => {
res(JSON.parse(responseBody)); // <- 949
});
}).on("error", (err) => rej(err));
});
}
return async (manifest) => {
if (schema == null && await isOffline())
return logger.warn(
"Cannot connect to json.schemastore.org, skipping validation"
);
logger.verbose(`Validating manifest...`);
if (manifest == null)
throw Error(`Manifest cannot be ${manifest}`);
await loadSchema();
...
Summary
The build step crashed when I passed
transformManifest
as an option ofwebExtension
and https://json.schemastore.org/chrome-manifest returned HTTP Error 503.The error log:
The code near
vite-plugin-web-extension/dist/index.js:949:20
:Environment