Publish a Vue Component to NPM // Vite and Vue 3

  Рет қаралды 30,141

LearnVue

LearnVue

Күн бұрын

Пікірлер: 64
@MrDaskaF
@MrDaskaF 2 жыл бұрын
About the 2 min mark, I think you missed that you have to add the file name to the template literal on line 14: fileName: (format) => `lv-button.${format}.js` . Did my head in for a bit, hope it helps someone else.
@Furlock627
@Furlock627 2 жыл бұрын
You just actually did! Thank you man
@nitraM321
@nitraM321 Жыл бұрын
i think that it's actually better to NOT include the name of the component in those filenames, it makes the package,json easier to reuse as you don't have to specify it
@robyc9545
@robyc9545 6 ай бұрын
why? he didn't talk much why we need the fileName field either.
@alexandervu6015
@alexandervu6015 2 жыл бұрын
One of best best starter tutorials I have seen so far.
@dmitrykurmanov
@dmitrykurmanov 2 жыл бұрын
6 minutes for the whole process! Perfect! Thanks!
@RodrigoDAgostino
@RodrigoDAgostino 3 жыл бұрын
Really concise and comprehensive guide :) You’re bringing up so many new things I’d like to try, but I still can’t find the time to do so xP Thank you!
@LearnVue
@LearnVue 3 жыл бұрын
thanks as always!
@dferg
@dferg 3 жыл бұрын
I’ve actually been wanting to see a quick run through of this exact thing. This is awesome, thanks
@LearnVue
@LearnVue 3 жыл бұрын
glad to see it was a timely video!
@dbroche
@dbroche 2 жыл бұрын
Know what I like about these videos? They’re always extremely USEFUL. And reflect what I actually want to learn! Speaking of “useful” how about a video on the VueUse library? ;}
@marcelojoc
@marcelojoc 2 жыл бұрын
hello, do you have any repository with this project? it would be very helpful
@yossarian499
@yossarian499 Жыл бұрын
Great tutorial, one point that I had to change, when|after following it, to make it work: At 1:52 fileName(format) => `${format}.js` is incomplete, as the it also needs the name. I did fileName (format) {return `${this.name}.${format}.js`}
@taylorjohnsonct
@taylorjohnsonct Жыл бұрын
This was a fantastic video that help me connect quite a few vite and package.json properties and what they're actually for.
@bernanribeiro3329
@bernanribeiro3329 2 жыл бұрын
This video made this be easy peasy. Thanks! I have just one question. Is it possible include our css directly in the component, without need import the style in your main project? I have I problem when try run my demo project, v-for from my plugin component doesnt work when I run build command.
@duketranslucent3rd
@duketranslucent3rd Жыл бұрын
Thanks fo sharing. However, this guide has a lot of issues, at least based on my experience. 1. You don't specify that to use `path` in vite.config.js, you must first require() it 2. You also don't specify that to require path, you need to first disable the default option of type=module in the package.json generated by `npm init vite` 3. When you say run `vite build`, you actually mean run the *script* command in the package.json which runs `vite build`, i.e. `npm run build`. Running the former will error. 4. It's not clear what should go into styles.css, or whether this should be explicitly created. 5. When I build, I end up with .mjs and .umd.js files, but not an .es.js file 6. Not sure if this is significant, but when you test this tutorial on NPM's runkit, it throws an error. All in all, when I link my package to another project and then try to use it, it says " The package may have incorrect main/module/exports specified in its package.json.".
@makboyakram
@makboyakram Жыл бұрын
This was the comment I have been looking for.
@lmartinez2205
@lmartinez2205 8 ай бұрын
Any fix?
@hideakitoro7530
@hideakitoro7530 5 ай бұрын
Great help! Not even Copilot could fix this, thx.
@sanusivictorolajuwon514
@sanusivictorolajuwon514 2 жыл бұрын
Hi LearnVue, this is a very good tutorial. Thanks for sharing. My question is that how I add typescript support to my published package so that people can get props auto-completion when they use it. Thanks.
@sanusivictorolajuwon514
@sanusivictorolajuwon514 Жыл бұрын
I do hope LearnVue can look into this
@nabenzanol
@nabenzanol Күн бұрын
Straight to the point, wondefull
@AndrewRusinas
@AndrewRusinas 3 жыл бұрын
Just in time 😍 I was looking for a way to create package with Vite and Vue 3, but had to stick with vue-sfc-rollup due to lack of information out there. What do you think about vue-sfc-rollup, btw?
@fikrinurfadillah6151
@fikrinurfadillah6151 8 ай бұрын
Great tutorial, but how to use our library in nuxt 3 project?
@mertcertel1989
@mertcertel1989 2 жыл бұрын
this exactly what i searching for ❤
@jigarprajapati897
@jigarprajapati897 4 ай бұрын
Thank you for making the video on this topic, I have create custom component with primevue and primevue.config is not loaded. can you please help me on it?
@andreasblondeau1682
@andreasblondeau1682 3 жыл бұрын
Exactly the video I needed, at the right time ! Thanks 😊
@LearnVue
@LearnVue 3 жыл бұрын
💚
@adammackintosh9645
@adammackintosh9645 Жыл бұрын
Surprisingly great tutorial, thanks
@PureAlbania
@PureAlbania 3 жыл бұрын
Great content. Will watch your other videos. Keep the good work.
@LearnVue
@LearnVue 3 жыл бұрын
thank you!
@kaandesu4881
@kaandesu4881 Жыл бұрын
Hi, great video! i have a question. I made a vite plugin for vue and tested in some projects with npm link before publish. and it worked pretty well with vite, Quasar Framework(with vite). But when I tried to install them to VueCli or Quasar Framework (with webpack), they did work but disabled the HMR. which made the reactive data from the plugin didn't shown unless a force update... Is it possible to make my vite plugin work in webpack environment? or i should try doing the same plugin somehow in webpack as well??
@bobek8030
@bobek8030 6 ай бұрын
is importing css inside app.vue necessary? can we do it automatically?
@Froggie92
@Froggie92 3 жыл бұрын
how do you feel about single components vs a monorepo for components
@iandashb
@iandashb Жыл бұрын
Thank you so much!!!!! And `npm link`, AWESOME!!!!
@bafian
@bafian 2 жыл бұрын
Thanks a lot ! Also looking for that typescript support :D
@johnkristijanhermann3420
@johnkristijanhermann3420 2 жыл бұрын
Great video! This example is for one component, but how do you add several components with modular import?
@LearnVue
@LearnVue 2 жыл бұрын
That's a question that someone solved on the GH for this, so I'd recommend giving it a read github.com/LearnVueCo/tutorial-code/issues/1 The tl;dr is to replace the Vue plugin with imports/exports of each component import LearnVueButton from './components/LearnVueButton.vue'; export { LearnVueButton };
@sanusivictorolajuwon514
@sanusivictorolajuwon514 Жыл бұрын
Hi LearnVue, how can we make this compatible with a Nuxt 3 app?
@abstractlym8320
@abstractlym8320 2 жыл бұрын
is this used to do microfrontend architecture?
@leonardssh
@leonardssh 3 жыл бұрын
I see that your videos look a lot like the ones made by Jeff (from @Fireship), and I like that, keep it up! l🥰
@LearnVue
@LearnVue 3 жыл бұрын
love those videos and have a similar goal of not creating super long videos but instead get you all the essential info as fast as possible!
@dbroche
@dbroche 2 жыл бұрын
@@LearnVue you’re doing a great job living up to your goal my friend
@i_bench_225
@i_bench_225 Жыл бұрын
But let's say i make a relatively big library, won't the .js file be bloated? How can i separate various components in different js files?
@suhagsidrayasarak5883
@suhagsidrayasarak5883 5 ай бұрын
how can we add iife or unpkg here as output in build
@NeelanshMathur
@NeelanshMathur 2 жыл бұрын
This is GREAT! One thing I really want to know is, I made a vue-ts project and want the typings (like my props) to be added in the final dist folder. Any idea how I can achieve that?
@smash3689
@smash3689 2 жыл бұрын
Use @rollup/plugin-typescript
@ColinRichardson
@ColinRichardson 2 жыл бұрын
And if you do not wish for it to install globally once you have imported it, and just use it standalone (but keep the option to have it install globally by default)? how would one do that?
@Santoshkumar-bb6jy
@Santoshkumar-bb6jy 2 жыл бұрын
hi, a nice video liked the way you explained. Have no issues with the build using vite, but when using on a vue project am getting the following error, any idea on how to resolve.........Uncaught TypeError: Cannot read properties of null (reading 'isCE')
@jamesfuller6520
@jamesfuller6520 2 жыл бұрын
It has to do with Vite bundling Vue into the library - I'm facing the same problem
@dalu_
@dalu_ Жыл бұрын
ok now again for a ts lib?
@shaiksadath7639
@shaiksadath7639 2 жыл бұрын
will this component work with vue 2 and vue class components?
@jonathan-arias
@jonathan-arias 2 жыл бұрын
Same question here.
@tbrew222
@tbrew222 2 жыл бұрын
Thank you!!!🙇🏾‍♂
@Pescado92
@Pescado92 Жыл бұрын
can you make an example but using typescript pls :)
@ZynthProductions
@ZynthProductions 3 жыл бұрын
Woah i just hoping you create a library tutorial and its really happen. 😲
@LearnVue
@LearnVue 3 жыл бұрын
👀 glad to hear
@palach_666
@palach_666 2 жыл бұрын
Please make this video with Nuxt3
@earthmovers8922
@earthmovers8922 2 жыл бұрын
How I can create NPM library using Vue2 without Vite?
@hannahchiamakaejimofor2571
@hannahchiamakaejimofor2571 Жыл бұрын
apt!!!👏
@musketeer765
@musketeer765 2 жыл бұрын
Can you give the whole code, please?
@MrT-tn4qe
@MrT-tn4qe Жыл бұрын
path is undefined, you are missing something from your code
@michaellautieri2723
@michaellautieri2723 2 жыл бұрын
Anyone else having issues rolling the lv-button? I tried today and got this error vite v3.0.2 building for production... ✓ 1 modules transformed. [vite:build-import-analysis] Parse error @:5:12 file: C:/Users/Michael/Desktop/vite-project/src/components/LearnVueButton.vue:5:11 3: 4: 5: ^ 6: 7: error during build: Error: Parse error @:5:12 at parse$b (file:///C:/Users/Michael/Desktop/vite-project/node_modules/vite/dist/node/chunks/dep-1513d487.js:33570:355) at Object.transform (file:///C:/Users/Michael/Desktop/vite-project/node_modules/vite/dist/node/chunks/dep-1513d487.js:40656:27)
⚡️ Vite - Создание и публикация NPM пакета
39:38
Игорь Бабко
Рет қаралды 1,5 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
УНО Реверс в Амонг Ас : игра на выбывание
0:19
Фани Хани
Рет қаралды 1,3 МЛН
UFC 287 : Перейра VS Адесанья 2
6:02
Setanta Sports UFC
Рет қаралды 486 М.
Create a Custom Component Library with Vue & Tailwind CSS
24:08
Vue Mastery
Рет қаралды 27 М.
Vue Slots Simplified
7:25
LearnVue
Рет қаралды 58 М.
Create a library using Vite lib mode
30:00
Alvaro Dev Labs
Рет қаралды 21 М.
Two Vue Directives that Boost App Performance
3:28
LearnVue
Рет қаралды 29 М.
A Better Way To Organize Components In Vue
10:10
Program With Erik
Рет қаралды 27 М.
Visual Guide to the Modern Frontend Toolchain (Vite)
9:18
Lachlan Miller
Рет қаралды 91 М.
Writing & Publishing your First NPM Package!
19:33
DesignCourse
Рет қаралды 91 М.
Vitest Simplified
4:55
LearnVue
Рет қаралды 36 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН