next-theme / hexo-optimize

🚩 A Hexo plugin that optimize the pages loading speed, written in Rust
MIT License
13 stars 2 forks source link

ERROR Plugin load failed: hexo-optimize #29

Closed XueshiQiao closed 1 year ago

XueshiQiao commented 1 year ago

Error output of "hexo gen"

ERROR Plugin load failed: hexo-optimize
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at getKeys (/Users/joey/Documents/Code/blog/node_modules/deepmerge/dist/cjs.js:61:16)
    at mergeObject (/Users/joey/Documents/Code/blog/node_modules/deepmerge/dist/cjs.js:86:2)
    at deepmerge (/Users/joey/Documents/Code/blog/node_modules/deepmerge/dist/cjs.js:117:10)
    at deepMerge (/Users/joey/Documents/Code/blog/node_modules/hexo-util/lib/deep_merge.js:22:10)
    at /Users/joey/Documents/Code/blog/node_modules/hexo-optimize/index.js:7:31
    at /Users/joey/Documents/Code/blog/node_modules/hexo/lib/hexo/index.js:305:14
    at tryCatcher (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/promise.js:729:18)
    at _drainQueueStep (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/async.js:102:5)
    at Async.drainQueues [as _onImmediate] (/Users/joey/Documents/Code/blog/node_modules/bluebird/js/release/async.js:15:14)
    at process.processImmediate (node:internal/timers:476:21)

"hexo-optimize" version is "3.3.0", all of other dependencies' version:

 "dependencies": {
    "hexo": "^6.3.0",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-feed": "^3.0.0",
    "hexo-generator-index": "^3.0.0",
    "hexo-generator-sitemap": "^3.0.1",
    "hexo-generator-tag": "^2.0.0",
    "hexo-next-giscus": "^1.1.0",
    "hexo-optimize": "^3.3.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-marked": "^6.0.0",
    "hexo-renderer-stylus": "^2.1.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-next": "^8.14.2",
    "hexo-word-counter": "^0.1.0",
    "highlight.js": "^11.7.0"
  }

System Info:

node -v v18.14.0

npm -v 9.3.1

macOS 13.2 (22D49) , M1 chip

stevenjoezhang commented 1 year ago

You can try to copy the following config to Hexo _config.yml

filter_optimize:
  enable: true
  # static resource versioning
  versioning: false
  css:
    # minify all css files
    minify: true
    excludes:
    # use preload to load css elements dynamically
    delivery:
      - '@fortawesome/fontawesome-free'
      - 'fonts.googleapis.com'
    # make specific css content inline into the html page
    inlines:
      # support full path only
      - css/main.css
  js:
    # minify all js files
    minify: true
    excludes:
    # remove the comments in each of the js files
    remove_comments: false
  html:
    # minify all html files
    minify: true
    excludes:
  # set the priority of this plugin,
  # lower means it will be executed first, default of Hexo is 10
  priority: 12