TypeError: t.test is not a function

This began after upgrading from 0.97.3 to 0.99.1.

Made sure the extended version is installed, and tried installing the packages mentioned in the error message: purgecss and cssnano.

I’m at a loss on how to keep debuging this issue.

Start building sites …
hugo v0.97.3-078053a43d746a26aa3d48cf1ec7122ae78a9bb4+extended darwin/amd64 BuildDate=2022-04-18T17:22:19Z VendorInfo=gohugoio
Error: Error building site: POSTCSS: failed to transform "css/style.css" (text/css): TypeError: t.test is not a function
    at /Users/brunoamaral/Labs/gregory/stdin:6:4
    at /Users/brunoamaral/Labs/gregory/node_modules/purgecss/lib/purgecss.js:1:9044
    at Array.some (<anonymous>)
    at P.isSelectorSafelistedGreedy (/Users/brunoamaral/Labs/gregory/node_modules/purgecss/lib/purgecss.js:1:9033)
    at /Users/brunoamaral/Labs/gregory/node_modules/purgecss/lib/purgecss.js:1:10103
    at Array.some (<anonymous>)
    at P.shouldKeepSelector (/Users/brunoamaral/Labs/gregory/node_modules/purgecss/lib/purgecss.js:1:10086)
    at /Users/brunoamaral/Labs/gregory/node_modules/purgecss/lib/purgecss.js:1:7137
    at /Users/brunoamaral/Labs/gregory/node_modules/postcss-selector-parser/dist/selectors/container.js:225:20
    at Root.each (/Users/brunoamaral/Labs/gregory/node_modules/postcss-selector-parser/dist/selectors/container.js:207:16)
    at Root.walk (/Users/brunoamaral/Labs/gregory/node_modules/postcss-selector-parser/dist/selectors/container.js:224:17) {
  postcssNode: Rule {
    raws: { before: '', between: '', semicolon: false, after: '' },
    type: 'rule',
    nodes: [
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration],
      [Declaration], [Declaration]
    ],
    parent: Root {
      raws: [Object],
      type: 'root',
      nodes: [Array],
      source: [Object],
      lastEach: 2,
      indexes: [Object],
      [Symbol(isClean)]: true,
      [Symbol(my)]: true
    },
    source: { start: [Object], input: [Input], end: [Object] },
    selector: ':root',
    lastEach: 2,
    indexes: {},
    [Symbol(isClean)]: true,
    [Symbol(my)]: true
  }
}

Assuming that your project repository is https://github.com/brunoamaral/gregory, I can reproduce the problem with v0.83.0 (the earliest version supported by NowUI-Pro) and later.

That’s interesting, because on linux the new 0.99.1 seems to work just fine:

gregory@house:~/gregory$ /usr/local/bin/hugo version
hugo v0.99.1-d524067382e60ce2a2248c3133a1b3af206b6ef1+extended linux/amd64 BuildDate=2022-05-18T11:18:14Z VendorInfo=gohugoio
gregory@house:~/gregory$ /usr/local/bin/hugo server
Start building sites …
hugo v0.99.1-d524067382e60ce2a2248c3133a1b3af206b6ef1+extended linux/amd64 BuildDate=2022-05-18T11:18:14Z VendorInfo=gohugoio

                   |  EN
-------------------+-------
  Pages            | 9355
  Paginator pages  | 2089
  Non-page files   |  227
  Static files     | 1748
  Processed images |   53
  Aliases          |   28
  Sitemaps         |    1
  Cleaned          |    0

Built in 368925 ms

The “t.test is not a function” error is triggered by:

https://github.com/brunoamaral/gregory/blob/main/assets/css/postcss.config.js#L6

According to the purgecss documentation, the regex patterns should not be surrounded by quotations. See https://purgecss.com/safelisting.html#patterns

I can reproduce the problem with v0.99.1 as well.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.