Мы хотим развернуть функцию на основе AMP Optimizer https://www.npmjs.com/package/@ampproject / toolbox-optimizer с функциями CloudFlare Workers https://developers.cloudflare.com/workers/quickstart/
Но при установке через npm: npm install @ampproject/toolbox-optimizer
При попытке развернуть функцию она всегда выдает разные ошибки
⬇️ Installing wranglerjs...
⬇️ Installing wasm-pack...
? ./index.js
Module not found: Error: Can't resolve 'cheerio' in '/Users/martinjuzefiszyn/ssr'
resolve 'cheerio' in '/Users/martinjuzefiszyn/ssr'
Parsed request is a module
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/Users/martinjuzefiszyn/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/martinjuzefiszyn/ssr/node_modules
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: ./node_modules/cheerio)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/cheerio doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/cheerio.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/cheerio.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/cheerio.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/cheerio.json doesn't exist
as directory
/Users/martinjuzefiszyn/ssr/node_modules/cheerio doesn't exist
[/Users/martinjuzefiszyn/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/martinjuzefiszyn/ssr/node_modules/cheerio]
[/Users/martinjuzefiszyn/ssr/node_modules/cheerio.wasm]
[/Users/martinjuzefiszyn/ssr/node_modules/cheerio.mjs]
[/Users/martinjuzefiszyn/ssr/node_modules/cheerio.js]
[/Users/martinjuzefiszyn/ssr/node_modules/cheerio.json]
@ ./index.js 23:16-34
./index.js
Module not found: Error: Can't resolve 'export.js' in '/Users/martinjuzefiszyn/ssr'
resolve 'export.js' in '/Users/martinjuzefiszyn/ssr'
Parsed request is a module
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/Users/martinjuzefiszyn/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/martinjuzefiszyn/ssr/node_modules
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: ./node_modules/export.js)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/export.js doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/export.js.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/export.js.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/export.js.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/export.js.json doesn't exist
as directory
/Users/martinjuzefiszyn/ssr/node_modules/export.js doesn't exist
[/Users/martinjuzefiszyn/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/martinjuzefiszyn/ssr/node_modules/export.js]
[/Users/martinjuzefiszyn/ssr/node_modules/export.js.wasm]
[/Users/martinjuzefiszyn/ssr/node_modules/export.js.mjs]
[/Users/martinjuzefiszyn/ssr/node_modules/export.js.js]
[/Users/martinjuzefiszyn/ssr/node_modules/export.js.json]
@ ./index.js 22:21-41
./index.js
Module not found: Error: Can't resolve 'fs' in '/Users/martinjuzefiszyn/ssr'
resolve 'fs' in '/Users/martinjuzefiszyn/ssr'
Parsed request is a module
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/Users/martinjuzefiszyn/node_modules doesn't exist or is not a directory
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
looking for modules in /Users/martinjuzefiszyn/ssr/node_modules
using description file: /Users/martinjuzefiszyn/ssr/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/martinjuzefiszyn/ssr/node_modules/fs/package.json (relative path: .)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs is not a file
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs.json doesn't exist
as directory
existing directory
use ./index.js from main in package.json
using description file: /Users/martinjuzefiszyn/ssr/node_modules/fs/package.json (relative path: .)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/martinjuzefiszyn/ssr/node_modules/fs/package.json (relative path: ./index.js)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.json doesn't exist
as directory
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js doesn't exist
using path: /Users/martinjuzefiszyn/ssr/node_modules/fs/index
using description file: /Users/martinjuzefiszyn/ssr/node_modules/fs/package.json (relative path: ./index)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/martinjuzefiszyn/ssr/node_modules/fs/index.json doesn't exist
[/Users/martinjuzefiszyn/node_modules]
[/Users/node_modules]
[/node_modules]
[/Users/martinjuzefiszyn/ssr/node_modules/fs]
[/Users/martinjuzefiszyn/ssr/node_modules/fs.wasm]
[/Users/martinjuzefiszyn/ssr/node_modules/fs.mjs]
[/Users/martinjuzefiszyn/ssr/node_modules/fs.js]
[/Users/martinjuzefiszyn/ssr/node_modules/fs.json]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.wasm]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.mjs]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.js]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.js.json]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.wasm]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.mjs]
[/Users/martinjuzefiszyn/ssr/node_modules/fs/index.json]
@ ./index.js 20:11-24
Error: webpack returned an error. You may be able to resolve this issue by running npm install.
Любые идеи, поскольку существуют зависимости, которые выдают нам ошибку при попытке предварительного просмотра Функция CloudFlare?
Любая другая идея, чтобы реализовать функцию на любом уровне пользователя, чтобы иметь возможность оптимизировать страницы усилителя на сервере? Установить NodeJs в Apache? AWS Лямбда?