"TypeError: atVariables is not a function" with v0.2.0.
ehoogeveen opened this issue · 12 comments
Node.js
version:v14.15.0 LTS
postcss-at-rules-variables
version:v0.2.0
After updating to the new version I get the error TypeError: atVariables is not a function
.
It appears that require('postcss-at-rules-variables')
now returns an object ({ default: [Function: _default], postcss: true}
) where other plugins return a function ([Function (anonymous)] { postcss: true }
).
I can work around the problem by using atVariables['default']()
instead, but I'm not sure what the side effects of that are, if any.
@ehoogeveen What version of postcss are you using?
I tested with postcss version 8.1.7 and pocstcss-cli version 8.2.0, on Windows.
I tested with postcss version 8.1.7 and pocstcss-cli version 8.2.0, on Windows.
Can you give an example or link where you get the error?
I just upgraded to 0.2.0 and had exactly the same issue.TypeError: i is not a function
I'm using in conjunction with postcss-mixins
- I'll try throw a mini reproduction together
That would be great, thanks. I've been meaning to make a test case but our setup is a bit arcane.
I've faced with a similar in AlexWayfer/flame-cli#57 (I'm trying to replace SCSS with PostCSS completely, so it's not quite this PR, but based on it).
> postcss assets/styles/ -d public/styles/ --base assets/styles/ --ext=css
TypeError: require(...) is not a function
at Object.<anonymous> (/home/alex/Projects/ruby/test/foo_bar/postcss.config.js:3:40)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at module.exports (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/import-fresh@3.2.2/node_modules/import-fresh/index.js:32:59)
at loadJs (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/cosmiconfig@7.0.0/node_modules/cosmiconfig/dist/loaders.js:16:18)
at Explorer.loadFileContent (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/cosmiconfig@7.0.0/node_modules/cosmiconfig/dist/Explorer.js:84:32)
at Explorer.createCosmiconfigResult (/home/alex/Projects/ruby/test/foo_bar/node_modules/.pnpm/cosmiconfig@7.0.0/node_modules/cosmiconfig/dist/Explorer.js:89:36)
My configuration:
// postcss.config.js
module.exports = {
plugins: [
// there can be more, but it's reproducible only with this package
require('postcss-at-rules-variables')({ atRules: ['media'] })
]
}
package.json
:
"dependencies": {
"@babel/core": "*",
"@babel/plugin-transform-object-assign": "*",
"@babel/preset-env": "*",
"@rollup/plugin-babel": "*",
"@rollup/plugin-commonjs": "*",
"@rollup/plugin-json": "*",
"@rollup/plugin-node-resolve": "*",
"autoprefixer": "*",
"postcss-at-rules-variables": "*",
"postcss-cli": "*",
"postcss-flexbugs-fixes": "*",
"postcss-mixins": "*",
"postcss-nested": "*",
"promise-polyfill": "*",
"rollup": "*",
"sass": "*",
"simplify-js": "*",
"whatwg-fetch": "*"
},
...
"scripts": {
"build:styles": "postcss assets/styles/ -d public/styles/ --base assets/styles/ --ext=css",
...
}
With version lock like this:
"postcss-at-rules-variables": "^0.1.0",
there is no such error.
With version lock like this:
"postcss-at-rules-variables": "^0.1.0",
there is no such error.
But it locks PostCSS at version 7, and other dependent packages too.
I've faced with a similar in AlexWayfer/flame-cli#57 (I'm trying to replace SCSS with PostCSS completely, so it's not quite this PR, but based on it).
Describe the configuration OS, nodejs ?
I've faced with a similar in AlexWayfer/flame-cli#57 (I'm trying to replace SCSS with PostCSS completely, so it's not quite this PR, but based on it).
Describe the configuration OS, nodejs ?
Arch Linux, Node.js 15.1.0
I found simpler project: https://github.com/AlexWayfer/alexwayfer.name
@ehoogeveen @spacedawwwg @AlexWayfer I made a small fix, please update the package. Let me know if it doesn't work for you.
do not hesitate to reopen the problem if your problem is not solved
Problem seems to be fixed for me, thanks!
Confirm, see no problems anymore, thank you.