postcss/postcss-import

TypeError: o.assign is not a function when using text-align: start or end

hendriku opened this issue · 3 comments

Disclaimer: I first posted this issue within webpack-contrib/css-loader#1402 but a maintainer mentioned that it is more likely to be related to this postcss plugin, so I am going to copy paste the content from over there.

Bug report

Actual Behavior

I am importing a .css file (using postcss-import) that contains text-align: start. Minimal reproduction sample is:

.test {
  text-align: start;
}

to be contained within the imported file.
When bundling (in my case through next.js) a weird error is being shown:

error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[2]!./src/styles/index.css
TypeError: o.assign is not a function

As soon as I change text-align: start to something like center or left/right it loads successfully.

Expected Behavior

It should accept text-align: start and end to support LTR and RTL reading directions and throw no errors (or maybe at least a more meaningful one 😓 ) so that I can load my css successfully.

How Do We Reproduce?

Use minimal script above. I haven't had the opportunity to test it with a non-next.js or non-postcss setup, maybe the situation is different there.

Please paste the results of npx webpack-cli info here, and mention other relevant information

Binaries:
Node: 16.5.0 - ~/.nvm/versions/node/v16.5.0/bin/node
Yarn: 3.1.1 - ~/.nvm/versions/node/v16.5.0/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.5.0/bin/npm
Browsers:
Chrome: 96.0.4664.110
Edge: 96.0.1054.62
Firefox: 93.0
Safari: 15.2
Packages:
babel-loader: ^8.2.3 => 8.2.3
compression-webpack-plugin: ^9.1.1 => 9.2.0
postcss-loader: ^6.2.1 => 6.2.1
style-loader: ^3.3.1 => 3.3.1
webpack: ^5.65.0 => 5.65.0
webpack-bundle-analyzer: ^4.5.0 => 4.5.0

Hmm, this is a weird one. Does it reproduce without webpack?

I think it's actually this issue : csstools/postcss-plugins#147
This was resolved.

@hendriku Can you update dependencies and re-test?

Assuming fixed.