sanity-io / language-filter

A Sanity plugin that supports filtering localized fields by language
MIT License
17 stars 1 forks source link

Could not resolve styled-component #31

Closed kapyar closed 1 year ago

kapyar commented 1 year ago

Hi have sanity v3.7.0 nextjs 13.2. I have installed from yarn this package and now have this error

`9:38:08 PM [vite] page reload sanity.config.ts ✘ [ERROR] Could not resolve "sanity"

../node_modules/@sanity/language-filter/lib/index.esm.js:1:1275:
  1 │ ...om"react/jsx-runtime";import{definePlugin as d}from"sanity";import{createContext as u,useMemo as g,useContext...
    ╵                                                       ~~~~~~~~

You can mark the path "sanity" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "styled-components"

../node_modules/@sanity/language-filter/lib/index.esm.js:1:1544:
  1 │ ... I,Button as L}from"@sanity/ui";import T from"styled-components";const P=(e,n,t)=>!e.name.startsWith("locale"...
    ╵                                                 ~~~~~~~~~~~~~~~~~~~

You can mark the path "styled-components" as external to exclude it from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "styled-components"

../node_modules/@sanity/ui/dist/index.esm.js:6:97:
  6 │ ...t styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
    ╵                                                                                                ~~~~~~~~~~~~~~~~~~~

You can mark the path "styled-components" as external to exclude it from the bundle, which will remove this error.

9:38:11 PM [vite] error while updating dependencies: Error: Build failed with 3 errors: ../node_modules/@sanity/language-filter/lib/index.esm.js:1:1275: ERROR: Could not resolve "sanity" ../node_modules/@sanity/language-filter/lib/index.esm.js:1:1544: ERROR: Could not resolve "styled-components" ../node_modules/@sanity/ui/dist/index.esm.js:6:97: ERROR: Could not resolve "styled-components" at failureErrorWithLog (/Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:1604:15) at /Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:1056:28 at runOnEndCallbacks (/Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:1476:61) at buildResponseToResult (/Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:1054:7) at /Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:1166:14 at responseCallbacks. (/Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:701:9) at handleIncomingPacket (/Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:756:9) at Socket.readFromStdout (/Users/yaroslavkaplunskyi/nextjs-projects/nextjs_TS/sanity-cms/node_modules/esbuild/lib/main.js:677:7) at Socket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:324:12)`

kapyar commented 1 year ago

updating to 3.8.0 solved the problem