parcel: parcel build fails with "semantic.min.css:undefined:undefined: decl.moveTo is not a function"

๐Ÿ› bug report

Iโ€™m using Semantic-UI-React and the build fails. In dev, itโ€™s working fine.

In my index.js, Iโ€™m importing the Semantic CSS file as follow:

import 'semantic-ui-css/semantic.min.css'

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

My .babelrc:

{
  "presets": ["env", "react"],
  "plugins": [
    "transform-object-rest-spread",
    "transform-class-properties",
    "react-hot-loader/babel"
  ]
}

๐Ÿค” Expected Behavior

The build should not failed!

๐Ÿ˜ฏ Current Behavior

The build fails with this error:

ร—  C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\semantic-ui-css\semantic.min.css:undefined:undefined: decl.moveTo is not a function
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\semantic-ui-css\semantic.min.css:19:919
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\semantic-ui-css\semantic.min.css:19:928
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\postcss-merge-rules\dist\index.js:246:22
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:135:18
    at Rule.each (C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:101:16)
    at Rule.walk (C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:131:17)
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\postcss-merge-rules\dist\index.js:242:18
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:239:18
    at C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:135:18
    at Root.each (C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:101:16)
    at Root.walk (C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:131:17)
    at Root.walkRules (C:\Users\mapu\dev\my\ilapak-hmi-electron\node_modules\parcel-bundler\node_modules\postcss\lib\container.js:237:19)

๐Ÿ’ Possible Solution

A downgrade of Semantic-UI or Parcel(?)

๐Ÿ”ฆ Context

Iโ€™m importing Sementic-UI-CSS as described in Sementic-UI documentation

๐Ÿ’ป Code Sample

import 'semantic-ui-css/semantic.min.css'

๐ŸŒ Your Environment

Software Version(s)
Parcel 1.11.0
Node 10.14.0
npm/Yarn 6.4.1
Operating System Windows 10
Sementic-UI 0.84.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@AlexMelw @jedgar1mx

Was getting the same issue with parcel 1.12.5 and cssnano v5. Downgraded cssnano to 4.1.11 and it started building.

npm uninstall cssnano npm i -D cssnano@4.1.11

Not sure if it will fix anyone elseโ€™s issue, but worked for us.

Run those commands wherever your package.json file is

Still the same problem here. I can fix it only by using --no-minify

Might be a cssnano bug, does it work with --no-minify?

I lov u bro it works for me

The latest htmlnano (0.2.2) uses the same cssnano (^4.1.8) of parcel-bundler. So, an htmlnano upgrade to 0.2.2 should fix this issue.

@AlexMelw @jedgar1mx

Was getting the same issue with parcel 1.12.5 and cssnano v5. Downgraded cssnano to 4.1.11 and it started building.

npm uninstall cssnano npm i -D cssnano@4.1.11

Not sure if it will fix anyone elseโ€™s issue, but worked for us.

Thank you.

npm uninstall cssnano npm i -D cssnano@4.1.11

thank you it worked

Still the same problem here. I can fix it only by using --no-minify

That helped as a quick temporary solution. But thatโ€™s a hack. We do need minification for production.

Yes, works with --no-minify. I guess itโ€™s a dep issue:

`-- parcel-bundler@1.11.0
  +-- cssnano@4.1.8
  | `-- cssnano-preset-default@4.0.6
  |   `-- postcss-merge-rules@4.0.2
  `-- htmlnano@0.1.10
    `-- cssnano@3.10.0
      `-- postcss-merge-rules@2.1.2

htmlnano@0.1.10 uses an old version of postcss-merge-rules.