Skip to content

fix: cannot resolve @textea/dev-kit/utils #134

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

Merged
merged 1 commit into from
Jan 1, 2023
Merged

Conversation

samhuk
Copy link
Contributor

@samhuk samhuk commented Dec 29, 2022

This fixes #133.

I think that it's because the dev-kit lib got put as a dev dependency, so when you npm install, it doesn't come along.

I think it's just an oopsie. Moving it from devDependencies to dependencies in package.json will fix this.

I think that a better fix will be to not even have this "DevelopmentError" in the code as it seems rather odd, but this at least fixes the issue.

@netlify
Copy link

netlify bot commented Dec 29, 2022

Deploy Preview for any-viewer ready!

Name Link
🔨 Latest commit 20d1db0
🔍 Latest deploy log https://app.netlify.com/sites/any-viewer/deploys/63ad81d2bcaff30008572244
😎 Deploy Preview https://deploy-preview-134--any-viewer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@samhuk samhuk changed the title Fix for https://github.com./TexteaInc/json-viewer/issues/133 Fix for "Can't resolve '@textea/dev-kit/utils'" error Dec 29, 2022
@samhuk
Copy link
Contributor Author

samhuk commented Dec 29, 2022

Temporary workaround if you have some build script that works for me:

// Temporary workaround for https://github.com./TexteaInc/json-viewer/issues/133
  let content = fs.readFileSync('./node_modules/@textea/json-viewer/dist/index.mjs', { encoding: 'utf8' })
  let newContent = content
    .replace('import { DevelopmentError } from \'@textea/dev-kit/utils\';', '')
    .replace('DevelopmentError', 'Error')
  fs.writeFileSync('./node_modules/@textea/json-viewer/dist/index.mjs', newContent, { encoding: 'utf8' })

  content = fs.readFileSync('./node_modules/@textea/json-viewer/dist/index.js', { encoding: 'utf8' })
  newContent = content
    .replace(' require(\'@textea/dev-kit/utils\'),', '')
    .replace(' \'@textea/dev-kit/utils\',', '')
    .replace(' global["@textea/dev-kit/utils"],', '')
    .replace('DevelopmentError', 'Error')
  fs.writeFileSync('./node_modules/@textea/json-viewer/dist/index.js', newContent, { encoding: 'utf8' })

1 similar comment
@samhuk
Copy link
Contributor Author

samhuk commented Dec 29, 2022

Temporary workaround if you have some build script that works for me:

// Temporary workaround for https://github.com./TexteaInc/json-viewer/issues/133
  let content = fs.readFileSync('./node_modules/@textea/json-viewer/dist/index.mjs', { encoding: 'utf8' })
  let newContent = content
    .replace('import { DevelopmentError } from \'@textea/dev-kit/utils\';', '')
    .replace('DevelopmentError', 'Error')
  fs.writeFileSync('./node_modules/@textea/json-viewer/dist/index.mjs', newContent, { encoding: 'utf8' })

  content = fs.readFileSync('./node_modules/@textea/json-viewer/dist/index.js', { encoding: 'utf8' })
  newContent = content
    .replace(' require(\'@textea/dev-kit/utils\'),', '')
    .replace(' \'@textea/dev-kit/utils\',', '')
    .replace(' global["@textea/dev-kit/utils"],', '')
    .replace('DevelopmentError', 'Error')
  fs.writeFileSync('./node_modules/@textea/json-viewer/dist/index.js', newContent, { encoding: 'utf8' })

@himself65 himself65 changed the title Fix for "Can't resolve '@textea/dev-kit/utils'" error fix: cannot resolve '@textea/dev-kit/utils' Dec 29, 2022
@himself65 himself65 changed the title fix: cannot resolve '@textea/dev-kit/utils' fix: cannot resolve @textea/dev-kit/utils Dec 29, 2022
@codecov
Copy link

codecov bot commented Dec 29, 2022

Codecov Report

Base: 87.91% // Head: 87.91% // No change to project coverage 👍

Coverage data is based on head (20d1db0) compared to base (9c2dee6).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #134   +/-   ##
=======================================
  Coverage   87.91%   87.91%           
=======================================
  Files          18       18           
  Lines        1903     1903           
  Branches      338      338           
=======================================
  Hits         1673     1673           
  Misses        230      230           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@anthonyalayo
Copy link
Contributor

I just hit the same issue, could this be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants