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

Something wrong with package exports #724

Closed
2 tasks done
nicksrandall opened this issue Feb 17, 2023 · 2 comments · Fixed by #725 or #737
Closed
2 tasks done

Something wrong with package exports #724

nicksrandall opened this issue Feb 17, 2023 · 2 comments · Fixed by #725 or #737
Labels
bug Something isn't working triage New issues that needs consideration

Comments

@nicksrandall
Copy link
Contributor

nicksrandall commented Feb 17, 2023

Bug report

Packages affected

  • sandpack-client
  • sandpack-react

Description of the problem

Error from esbuild

✘ [ERROR] Could not resolve "@codesandbox/sandpack-client"

    ../../node_modules/.pnpm/@codesandbox+sandpack-react@2.0.6_biqbaboplfbrettd7655fr4n2y/node_modules/@codesandbox/sandpack-react/dist/esm/index.js:7:95:
      7 │ ...kClient, extractErrorDetails } from '@codesandbox/sandpack-client';
        ╵                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Importing the directory "./dist" is forbidden by this package:

    ../../node_modules/.pnpm/@codesandbox+sandpack-react@2.0.6_biqbaboplfbrettd7655fr4n2y/node_modules/@codesandbox/sandpack-client/package.json:21:16:
      21 │       "import": "./dist",
         ╵                 ~~~~~~~~

  The presence of "exports" here makes importing a directory forbidden:

    ../../node_modules/.pnpm/@codesandbox+sandpack-react@2.0.6_biqbaboplfbrettd7655fr4n2y/node_modules/@codesandbox/sandpack-client/package.json:15:2:
      15 │   "exports": {
         ╵   ~~~~~~~~~

What were you doing when the problem occurred?

Trying to build an app using esbuild.

Your Environment

Software Name/Version
Sandpack-client version
Sandpack-react version 2.0.6
Browser
Operating System
@nicksrandall nicksrandall added bug Something isn't working triage New issues that needs consideration labels Feb 17, 2023
nicksrandall added a commit to nicksrandall/sandpack that referenced this issue Feb 17, 2023
@danilowoz
Copy link
Member

ohhhh exports...

@DeMoorJasper does it make sense for you? I'm not an expert on exports

@azu
Copy link

azu commented Feb 20, 2023

I noticed that

"./clients/node": {
"import": "./dist/clients/node/index.js",
"require": "./dist/clients/node/index.js"
refer same .js in import/require.

Maybe

    "./clients/node": {
-     "import": "./dist/clients/node/index.js",
+     "import": "./dist/clients/node/index.mjs",
      "require": "./dist/clients/node/index.js"

FYI: publint will be helpful(This ESM and CJS decision seems buggy).
https://publint.dev/@codesandbox/sandpack-client@2.0.7

danilowoz pushed a commit that referenced this issue Feb 20, 2023
Co-authored-by: Danilo Woznica <danilowoz@gmail.com>
fix #724
fix #677
olekxandr pushed a commit to olekxandr/sandpack that referenced this issue Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New issues that needs consideration
Projects
None yet
3 participants