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

Module not found: Error: Can't resolve '@adobe/leonardo-contrast-colors' #173

Open
skylerknight opened this issue Aug 21, 2022 · 4 comments · May be fixed by #185
Open

Module not found: Error: Can't resolve '@adobe/leonardo-contrast-colors' #173

skylerknight opened this issue Aug 21, 2022 · 4 comments · May be fixed by #185
Labels
bug Something isn't working

Comments

@skylerknight
Copy link

skylerknight commented Aug 21, 2022

Description

Unable to use package. Keep getting "Module not found" or "No exported member" errors.

I have tried both npm and yarn, with CRA and vite.

Steps to reproduce

  1. Initiate a basic application: npx create-react-app learn-leo

  2. Install package npm i @adobe/leonardo-contrast-colors

  3. Import Leonardo Package:

// App.js

import * as Leo from "@adobe/leonardo-contrast-colors"
  1. Run application:npm start

  2. Resulting error:

Failed to compile.

Module not found: Error: Can't resolve '@adobe/leonardo-contrast-colors' in '/Users/username/Development/learn-leo/src'
ERROR in ./src/App.js 6:0-50
Module not found: Error: Can't resolve '@adobe/leonardo-contrast-colors' in '/Users/username/Development/learn-leo/src'

webpack compiled with 1 error

Expected behavior

Expected to be able to import and use the leonardo package.

Screenshots

Screen Shot 2022-08-21 at 2 12 20 PM

Leonardo package and version

@leonardo-contrast-colors version: ^1.0.0-alpha.16

Environment

  • Browser(s) and OS(s):
    OS: MacOS: 12.5.1
    Browseer: Version 104.0.5112.101 (Official Build) (arm64)

Additional context

It appears that there may be something wrong with the exposed modules/files for export.

The package may have incorrect main/module/exports specified in its package.json.

UPDATE: I've tested with Version 1.0.0-alpha.13 and I am no longer seeing this error. It must have something to do with the latest release.

@skylerknight skylerknight added the bug Something isn't working label Aug 21, 2022
@elyulka
Copy link

elyulka commented Aug 25, 2022

@skylerknight package.json contains incorrect "main" and "export" fields. Next changes fix the issue:

"main": "./dist/index.js",
"exports": {
    ".": {
      "default": "./dist/index.js"
    }
  },

Upd: Nope, gives ReferenceError: exports is not defined in ES module scope

There is type: "module" and index.mjs present but it's not usable at least because of required utils.mjs uses apca-w3 that isn't present in dependencies but indevDependencies.

@NateBaldwinDesign It became broken after PR #166 had been merged

@skylerknight
Copy link
Author

@elyulka Aha,thanks for the info

@pabloromeroelux
Copy link

pabloromeroelux commented Sep 29, 2022

what's the best way around so far? Backing to 1.0.0-alpha.13 gives me this #175. I might be missing something about how to use the package

@xaddict
Copy link

xaddict commented Aug 4, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants