DocSpring / craco-antd

A craco plugin to use Ant Design with create-react-app
MIT License
234 stars 49 forks source link

ValidationError on `lessLoaderOptions.javascriptEnabled` #33

Closed daniel-hauser closed 4 years ago

daniel-hauser commented 4 years ago

2 days ago craco-less upgraded less-loader from 5 to 6 that has a braking change.

This causes the following error:

ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'javascriptEnabled'. These properties are valid:
   object { lessOptions?, prependData?, appendData?, sourceMap?, implementation? }

There are 2 fixes that can be done:

  1. Pin the version of craco-less to 1.16.0
  2. Use the new lessOptions as described here
ndbroadbent commented 4 years ago

Hello, yes it can be difficult to keep everything in sync. In the meantime, please use an older version of craco-less, or I would be happy to merge a pull request that adds support for the new version of craco-less. Thanks!

daniel-hauser commented 4 years ago

Thanks for the quick answer. For now - ill open a PR that pins the craco-less version, ill be happy if you approve it

ndbroadbent commented 4 years ago

Hello, I've updated craco-less and the less loader to the latest versions, and the changes have been pushed to craco-antd version 1.15.0

adijesori commented 4 years ago

@ndbroadbent I'm having the same error mentioned by @daniel-hauser also in the new version 1.15.0

ValidationError: Invalid options object. Less Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'javascriptEnabled'. These properties are valid:
   object { lessOptions?, prependData?, appendData?, sourceMap?, implementation? }
daniel-hauser commented 4 years ago

@ndbroadbent the issue wasn't fixed, can you please re-open it?

As I mentioned earlier, there are only 2 options:

  1. pin craco-less to 1.16.0 (uses less-loader@5) - a hotfix, done in #34
  2. change the code here to work with less-loader@6 (see changes here) - the real fix, but can brake code for current users
adijesori commented 4 years ago

@ndbroadbent Thanks for reopening! Can #34 or #35 be merged please? I'm not sure why they were closed without merging

davidvazinwnwd commented 4 years ago

I have the same issue too!! what can I do?>

aitsvet commented 4 years ago

Why pin to older version, let's correct this: https://github.com/DocSpring/craco-antd/pull/37

ndbroadbent commented 4 years ago

Hi everyone, sorry about that! I thought this was fixed but I guess the tests didn't catch the problems so these need to be improved. I've merged #36 to pin craco-less to < 1.17.0. #37 was a good attempt (Thanks @aitsvet!), but unfortunately it needs some changes to preserve any existing lessOptions: https://github.com/DocSpring/craco-antd/pull/37#pullrequestreview-421724640