Giter Club home page Giter Club logo

sanity-typed-issue's Introduction

Minimal bug reproduction

This readme outlines the steps to take to reproduce an error I encountered while debugging issue saiichihashimoto/sanity-typed#394 (comment). Please mind that this does not reproduce a bug in the original package, but is just an explanation of the steps I took to encounter this specific error.

Node: v18.19.0 NPM: v10.2.3 PNPM: v8.11.0

Steps

Add Minimal Version of Sanity Typed

Commit: 38e587a2a78e106a35c7f424f81f3c2af6058e04

  • Set up a NPM Workspace to utilize local dependencies from @sanity-typed/types. Included only tsconfig, types, and utils for minimal setup.
  • Built the types package using npm run build in the types folder, with tsup.config.ts from the original repository. (Note that the dist folder is not included in the repository, so to reproduce this step, you'll have to build the package yourself.)

Add Sanity Studio

Commit: 2147524f3b46a13efc0b1c2f3c47f2cb365b365a

  • Created a new sanity-studio package running pnpm create sanity@latest.
  • Installed necessary dependencies with pnpm.

Install Local Sanity Typed and Trigger Resolution Error

Commit: 167576d18d943b03676cd70b9ec402fd7e5a9be9

Uncaught error: The requested module '/@fs/Users/wannes/Projecten/Web/waspeer/sanity-typed-issue/sanity-typed/types/dist/index.js?t=1701806909825' does not provide an export named 'defineArrayMember'.

Triggering the module not defined Error

Commit: 4606b0b2cc396fafcdc4699b0f0219d6f8684bba

I triggered this error while debbugging the previous error. I just wanted to include it here to show how I encountered it.

  • Temporarily reverted the imports back to sanity instead of @sanity-typed/types to remove the error.
  • Added these lines for debugging:
import * as sanityTypedTypes from '@sanity-typed/types'
console.log('sanityTypedTypes', sanityTypedTypes)
ReferenceError: module is not defined
    at http://localhost:3333/@fs/Users/wannes/Projecten/Web/waspeer/sanity-typed-issue/sanity-typed/types/dist/index.js:32:1

Building the Types Package as ESM

Commit: a2fb3d6bc6d0e8ad013e83ad2a484bef1a6f9566

  • Built the types package to ESM using tsup. (To reproduce this step, run npm run build-esm in the types folder.)
  • Changed the main and types fields in package.json to export the ESM files.
  • This change resolved the import/export issue in the studio.

sanity-typed-issue's People

Contributors

waspeer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.