Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node critical.js #6

Open
helly2 opened this issue Feb 16, 2022 · 5 comments
Open

node critical.js #6

helly2 opened this issue Feb 16, 2022 · 5 comments

Comments

@helly2
Copy link

helly2 commented Feb 16, 2022

When executing build.sh it stuck in line
node critical.js
it throws this error

(node:1300277) UnhandledPromiseRejectionWarning: Error: ConfigError: "dest" is n ot allowed
(node:1300277) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Th is error originated either by throwing inside of an async function without a cat ch block, or by rejecting a promise which was not handled with .catch(). (reject ion id: 1)
(node:1300277) [DEP0018] DeprecationWarning: Unhandled promise rejections are de precated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@gwijayas
Copy link

I have the same issue. There is no "index.html" on the build folder. After add --trace-warnings on the build.sh got this message:

./build.sh
+ uglifycss --output build/style_min.css style.css
+ uglifyjs --output build/script_min.js script.js web_miner/miner.js
+ uglifyjs --output build/worker.js web_miner/worker.js
+ cp web_miner/cn.min.js build/cn.min.js
+ html-minifier --output build/index-raw.html index.html --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true
+ node --trace-warnings critical.js
(node:503461) UnhandledPromiseRejectionWarning: Error: ConfigError: "dest" is not allowed
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:503461) Error: ConfigError: "dest" is not allowed
(node:503461) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
+ rm build/index-raw.html
+ echo OK
OK

@helly2
Copy link
Author

helly2 commented Feb 21, 2022

edit critical.js and remove dest like below, it should work

// npm i -D critical@latest

"use strict";

var critical = require('critical');

critical.generate({
inline: true,
base: 'build',
src: './index-raw.html',
target: './index.html',
minify: false,
width: 1024,
height: 768
});

@gwijayas
Copy link

gwijayas commented Feb 22, 2022

I edit critical.js:

// npm i -D critical@latest

"use strict";

var critical = require('critical');

critical.generate({
    inline: true,
    base: 'build',
    src: './index-raw.html',
    target: './index.html',
    minify: false,
    width: 1024,
    height: 768
});

But, I got the new error:

i$ ./build.sh
+ uglifycss --output build/style_min.css style.css
+ uglifyjs --output build/script_min.js script.js web_miner/miner.js
+ uglifyjs --output build/worker.js web_miner/worker.js
+ cp web_miner/cn.min.js build/cn.min.js
+ html-minifier --output build/index-raw.html index.html --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true
+ node --trace-warnings critical.js
(node:4357) UnhandledPromiseRejectionWarning: Error: ConfigError: "minify" is not allowed
    at emitUnhandledRejectionWarning (internal/process/promises.js:168:15)
    at processPromiseRejections (internal/process/promises.js:247:11)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
(node:4357) Error: ConfigError: "minify" is not allowed
(node:4357) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
    at emitDeprecationWarning (internal/process/promises.js:180:11)
    at processPromiseRejections (internal/process/promises.js:249:13)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
+ rm build/index-raw.html
+ echo OK
OK

Ubuntu 20.04, node v14.17.3

@gwijayas
Copy link

in the end, I delete minify from critical.js

@helly2
Copy link
Author

helly2 commented Feb 22, 2022

delete minify: false, from critical.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants