Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@sanity/ui Module parse failed. #155

Closed
bryanjhickey opened this issue Dec 29, 2022 · 3 comments
Closed

@sanity/ui Module parse failed. #155

bryanjhickey opened this issue Dec 29, 2022 · 3 comments

Comments

@bryanjhickey
Copy link

Steps to reproduce
1./ Follow steps 1 -> 3 as per README
3./ Visit studio `http://localhost:3000/studio
4./ Development server crashes with the following error.

error - ./node_modules/@sanity/ui/dist/index.esm.js
Module parse failed: 'import' and 'export' may appear only with 'sourceType: module' (61:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
| function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
> import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
| import { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1 } from 'react';
| import ReactIs, { isElement as isElement$1, isFragment, isValidElementType } from 'react-is';
```

This error occurs with Yarn, PNPM and NPM package managers.
@sirojinadias
Copy link

Same here

@stipsan
Copy link
Member

stipsan commented Dec 30, 2022

Hi, until sanity-io/ui#1038 is merged and released you can lock your @sanity/ui version to 1.0.4 🙌

@ehowey
Copy link
Contributor

ehowey commented Dec 31, 2022

If you are using Yarn you can use a feature called resolutions to do this pretty easily.

Docs here: https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/

Code added in your package.json:

 "resolutions": {
    "@sanity/ui": "1.0.4"
  },

@stipsan stipsan closed this as completed in 47120c2 Jan 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants