csstools / postcss-preset-env

Convert modern CSS into something browsers understand
https://github.com/csstools/postcss-plugins/tree/main/plugin-packs/postcss-preset-env
Creative Commons Zero v1.0 Universal
2.22k stars 90 forks source link

TypeError while processing `place-*` properties #225

Closed OpportunityLiu closed 2 years ago

OpportunityLiu commented 2 years ago

https://runkit.com/opportunity/typeerror-while-processing-place--properties

const postcss = require('postcss'); // 8.3.11
const postcssPresetEnv = require('postcss-preset-env'); //7.0.0
const autoprefixer = require('autoprefixer'); // 10.4.0

const YOUR_CSS = `
a {
  place-self: center;
}
`;

console.log(await postcss([autoprefixer({ overrideBrowserslist: 'defaults' })])
    .process(YOUR_CSS, { from: undefined }))
// this succeeded

console.log(await postcss([postcssPresetEnv({ browsers: 'defaults' })])
    .process(YOUR_CSS, { from: undefined }))
// this throws
TypeError: Cannot read properties of undefined (reading 'includes')
    at <input css A2IwH2>:3:3
    at OldValue.check (C:\U\node_modules\autoprefixer\lib\old-value.js:15:15)
    at C:\U\node_modules\autoprefixer\lib\processor.js:464:22
    at C:\U\node_modules\postcss\lib\container.js:72:18
    at C:\U\node_modules\postcss\lib\container.js:55:18
    at Rule.each (C:\U\node_modules\postcss\lib\container.js:41:16)
    at Rule.walk (C:\U\node_modules\postcss\lib\container.js:52:17)
    at C:\U\node_modules\postcss\lib\container.js:60:24
    at Root.each (C:\U\node_modules\postcss\lib\container.js:41:16)
    at Root.walk (C:\U\node_modules\postcss\lib\container.js:52:17)
    at Root.walkDecls (C:\U\node_modules\postcss\lib\container.js:70:19) {
  postcssNode: <ref *2> Declaration {
    raws: { before: '\n  ', between: ': ' },
    type: 'decl',
    source: { start: [Object], input: [Input], end: [Object] },
    prop: 'align-items',
    value: undefined,
    parent: <ref *1> Rule {
      raws: [Object],
      type: 'rule',
      nodes: [Array],
      parent: [Root],
      source: [Object],
      selector: 'a',
      lastEach: 16,
      indexes: [Object],
      proxyCache: [Circular *1],
      _autoprefixerDisabled: false,
      [Symbol(isClean)]: true,
      [Symbol(my)]: true
    },
    proxyCache: [Circular *2],
    _autoprefixerDisabled: false,
    [Symbol(isClean)]: true,
    [Symbol(my)]: true
  }
}
Antonio-Laguna commented 2 years ago

@OpportunityLiu this should hopefully be fixed but runkit is still having the old version cached. Not sure if this is a small case from your codebase.

OpportunityLiu commented 2 years ago

That's ok. Just use runkit to make sure this is not caused by other installed packages.

romainmenke commented 2 years ago

Thank you @OpportunityLiu for reporting this by the way!

We found another bug while looking into this one. Always helpful to receive feedback :)

Antonio-Laguna commented 2 years ago

@OpportunityLiu I've tried to fix this on runkit and wasn't able. I couldn't reproduce this bug locally nor on a simple node file with the same code on the runkit. Are you experiencing this locally?

OpportunityLiu commented 2 years ago

@Antonio-Laguna Nope, just a warning of #224