-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add npm package cookbook entry #664
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
Conversation
Would adding a section about typescript be out of scope here? "Packaging your typescript SFCs for NPM" is still a little hard to find details about, and this guide is already like 80% of the way there. https://github.com/politico/vue-accessible-selects/blob/main/rollup.config.js is a great minimal example that was shared with me recently. Another section with an updated rollup config that basically explains how If this is out of scope for this cookbook, what would be the best place to put this info, and would a PR be welcome? |
}), | ||
buble() // Transpile to ES5 | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about mentioning the external
configuration param here? At a minimum, almost all users are going to want external: ['vue']
, right? The ESM guide on freecodecamp above also doesn't mention this.
Because this guide covers all types of builds, I'm not sure how to best mention this, but I can see it being a stumbling block for readers of this guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm aware that this is mostly just copied from the Vue 2 docs but I've provided feedback on anything that caught my eye.
|
||
### How does npm know which version to serve to a browser/build process? | ||
|
||
The `package.json` file used by npm really only requires one version (`main`), but as it turns out, we aren't limited to that. We can address the most common use cases by specifying 2 additional versions (`module` and `unpkg`), and provide access to the `.vue` file itself using the `browser` field. A sample package.json would look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear what the convention is for putting filenames in backticks. package.json
is mentioned several times in this page, sometimes with backticks and sometimes without.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried catching them all, can give it another lookthrough. It's a good point we should make a convention around this and put it in the writing guide. In this case, I felt like it was hard to read without the distinction but could be persuaded.
@subdavis, we would love a PR for this! I mentioned to the team that I was bringing this over as a first pass, to then be refactored and reworked. What works best for you? I guess my preference is to work iteratively, where we PR this first pass in and you follow it up with improvements and new sections, but I'm flexible. |
Adding a typescript section as an independent PR sounds great since it's new content. I'll follow up with something after this merges. Thank you. |
install | ||
} | ||
|
||
// Auto-install when vue is found (eg. in browser via <script> tag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Vue now provides its global API for component registration etc. on an app instance, not the constructor, auto-install is no longer possible in Vue 3
I've thought a lot about this entry, and I think enough has changed is new, that it can't simply be migrated, we need to rewrite it. I'm going to close it out now. |
Reworked some of this during the migration- will likely take another pass at updating it soon as well :)