sanity-plugin-order-documents icon indicating copy to clipboard operation
sanity-plugin-order-documents copied to clipboard

Unable to start sanity server after installing latest version of this package

Open khalilp5 opened this issue 2 years ago • 8 comments

I have been trying to use this package with my sanity repo and upon installing the latest version or this repo I'm getting the following error:

Error in ./node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js
Module parse failed: Unexpected token (306:11)
You may need an appropriate loader to handle this file type.
|   }
| 
|   return { ...rect,
|     x: rect.x - scroll.scrollLeft + offsets.x,
|     y: rect.y - scroll.scrollTop + offsets.y
 @ ./node_modules/sanity-plugin-order-documents/node_modules/react-select/dist/react-select.esm.js 23:0-26
 @ ./node_modules/sanity-plugin-order-documents/build/components/organisms/TypeSection.js
 @ ./node_modules/sanity-plugin-order-documents/build/components/OrderDocuments.js

Here is my project package list:

    "@sanity/base": "^2.30.1",
    "@sanity/core": "^2.30.2",
    "@sanity/default-login": "^2.30.1",
    "@sanity/desk-tool": "^2.30.1",
    "@sanity/eslint-config-studio": "^2.0.0",
    "@sanity/vision": "^2.30.1",
    "eslint": "^8.6.0",
    "prop-types": "^15.7",
    "react": "^17.0",
    "react-dom": "^17.0",
    "sanity-plugin-order-documents": "^0.0.23",
    "styled-components": "^5.2.0"

khalilp5 avatar Oct 15 '22 19:10 khalilp5

Same issue here

eeerlend avatar Oct 16 '22 15:10 eeerlend

I tried lowering the version and it worked. But it had a lot of peer dependency conflicts. Just wondering what is breaking in latest version.

khalilp5 avatar Oct 16 '22 20:10 khalilp5

This wasted a lot of time for me today but I resolved for now by editing my package.json from: "sanity-plugin-order-documents": "^0.0.23", to: "sanity-plugin-order-documents": "0.0.19",

lab-bone-Max avatar Oct 21 '22 21:10 lab-bone-Max

This wasted a lot of time for me today but I resolved for now by editing my package.json from: "sanity-plugin-order-documents": "^0.0.23", to: "sanity-plugin-order-documents": "0.0.19",

What version of sanity are you using? I managed to install version 0.0.19 sanity-plugin-order-documents. I can change the order of documents as in the gif but it does not save. gif

sp4rq-dev avatar Oct 25 '22 10:10 sp4rq-dev

What version of sanity are you using? I managed to install version 0.0.19 sanity-plugin-order-documents. I can change the order of documents as in the gif but it does not save.

I am also facing the same problem. Did u find any solution?

MithilHassan avatar Nov 01 '22 08:11 MithilHassan

What version of sanity are you using? I managed to install version 0.0.19 sanity-plugin-order-documents. I can change the order of documents as in the gif but it does not save.

I am also facing the same problem. Did u find any solution?

Change the version of the package to 0.0.19 from 0.0.23

khalilp5 avatar Nov 01 '22 17:11 khalilp5

For me, Sanity Studio makes me look amazing as a developer but is only <5% of my project so I just want it to "work". I tried again to get my project to build with current release of order-document (0.0.23) but I still get the same errors with floating-ui dependancy. Forcing this plugin to 0.0.19 still allows me to build and deploy my project as of Nov 22

maxlyth avatar Nov 03 '22 02:11 maxlyth

@MithilHassan @sp4rq-dev

I'm using the 0.0.19 too and the order inside this plugin correctly changes both visually and in the "raw" data. The problem is just that visually the document order doesn't change into the original documents tab.

Moreover, if you go to your schema and change from this:

{
    name: 'order',
    title: 'Order',
    type: 'number',
    hidden: true,
},

to this

{
    name: 'order',
    title: 'Order',
    type: 'number',
},

Inside your documents, you can see that the order is correctly written

LGala avatar Nov 17 '22 14:11 LGala

Downgrading order-document did not work for long so I spent a bunch more time and I now I have a permanent fix for this that also works with 0.0.23.

If you don't already have a Webpack config file then create webpack.sanity.js at the root of your project and set the content to:

module.exports = function (config, options) {
  config.module.rules[0].exclude = {
    test: /(node_modules|bower_components)/,
    not: [
      /@floating-ui\/dom/,
      /@floating-ui\/core/,
    ]
  };
  return config;
};

maxlyth avatar Nov 23 '22 18:11 maxlyth

Hi guys, in version 0.0.24 we have moved away from relying on the react-select package (which has the error-causing floating-ui as its dependency).

You should no longer experience parsing errors in 0.0.24+.

BretCameron avatar Dec 12 '22 12:12 BretCameron