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

feat(octicons-react): add files to package.json and update npmignore #895

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

joshblack
Copy link
Member

Update the package.json and .npmignore for the @primer/octicons-react package. Specifically,

  • Add the files array to package.json to include only the files needed for publish
  • Update the .npmignore file to match on patterns currently being included in the package
  • Add the exports field to package.json with the import and require keys

@joshblack joshblack requested a review from a team as a code owner January 13, 2023 18:08
@changeset-bot
Copy link

changeset-bot bot commented Jan 13, 2023

🦋 Changeset detected

Latest commit: 09b5a77

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@joshblack joshblack changed the title fix(octicons-react): add files to package.json and update npmignore feat(octicons-react): add files to package.json and update npmignore Jan 13, 2023
Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@joshblack joshblack merged commit ce11fb3 into main Jan 17, 2023
@joshblack joshblack deleted the fix/update-octicons-react-npm branch January 17, 2023 15:47
@primer-css primer-css mentioned this pull request Jan 18, 2023
Comment on lines +10 to +13
"exports": {
"import": "dist/index.esm.js",
"require": "dist/index.umd.js"
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi I now get an error when running next build

> next build

info  - Skipping validation of types
info  - Linting  
info  - Creating an optimized production build  
info  - Compiled successfully
info  - Collecting page data .Error [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "dist/index.umd.js" defined in the package config /node_modules/@primer/octicons-react/package.json; targets must start with "./"
    at new NodeError (node:internal/errors:400:5)
    at invalidPackageTarget (node:internal/modules/esm/resolve:389:10)
    at resolvePackageTargetString (node:internal/modules/esm/resolve:445:11)
    at resolvePackageTarget (node:internal/modules/esm/resolve:522:12)
    at resolvePackageTarget (node:internal/modules/esm/resolve:571:31)
    at packageExportsResolve (node:internal/modules/esm/resolve:635:27)
    at resolveExports (node:internal/modules/cjs/loader:538:36)
    at Module._findPath (node:internal/modules/cjs/loader:607:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1025:27)
    at mod._resolveFilename (/Users/gr2m/code/github/howie/app/node_modules/next/dist/build/webpack/require-hook.js:27:32) {
  code: 'ERR_INVALID_PACKAGE_TARGET'
}

I think these should be

  "exports": {
    "import": "./dist/index.esm.js",
    "require": "./dist/index.umd.js"
  },

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that making the change resolves the problem

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there you go #905

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

Successfully merging this pull request may close these issues.

5 participants