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

Feature request: Vue components #5

Closed
jpsc opened this issue Dec 5, 2017 · 81 comments
Closed

Feature request: Vue components #5

jpsc opened this issue Dec 5, 2017 · 81 comments

Comments

@jpsc
Copy link

jpsc commented Dec 5, 2017

Using vue-component-compiler.

@devongovett
Copy link
Member

Yep, totally want to do this. May require some changes to how the internals work to allow an asset to have multiple sub-assets I guess (e.g. script, style, etc.). I'm working on how this might work and will update this issue.

@mubaidr
Copy link

mubaidr commented Dec 6, 2017

Just to remind that subsections can be js, ts, pug, html, css, scss, stylus.

@jamiebuilds
Copy link
Member

@sdras Do you know anyone in the Vue community who might be willing to help with this?

@sdras
Copy link

sdras commented Dec 6, 2017

I'm not sure their availability, but @kazupon, @Jinjiang and @Alex-Sokolov are major contributors to vue-loader, so they might be interested/the best people to talk to.

@kazupon
Copy link

kazupon commented Dec 6, 2017

In the roadmap of vue project, vue-componet-compiler work in progress.
Design Thread: vuejs/vue-component-compiler#28

The goal of this project support to a bundle-agnostic package so that it can be reused in all tooling in the ecosystem.

You might be asked @znck and @eddyerburgh about it than I do.

@znck
Copy link

znck commented Dec 7, 2017

I would suggest you use vue-component-compiler, this would keep parcel at feature parity with officially maintained build utils like vue-loader etc.

vuejs/vue-component-compiler#28 is awaiting final design review. The example implementation covers everything discussed in the thread, you should join above design thread to express your concerns.

@eddyerburgh
Copy link

I could help build this in the new year

@davidnagli
Copy link
Contributor

@shawwn Are you also working on this?

@zzz6519003
Copy link

zzz6519003 commented Dec 12, 2017

how does @webpack implement this

@eddyerburgh
Copy link

@zzz6519003 There's a vue-loader maintained by Vue.

We're planning to add support for Vue SFCs to parcel core.

@znck
Copy link

znck commented Dec 14, 2017

@devongovett Hey! I need to understand how parcel works to make vue-component-compiler work with it.

In order to compile .vue file, <style>, <template> & <script> parts should be preprocessed.

  • With webpack, required loaders are added in require string.
  • With rollup, resolve & resolveId is used to import parts of the vue file.

The question:
How to mock/resolve part of a file as another asset? How to process part of a file (e.g. template with pug, style with scss etc) and collect result?

@zzz6519003
Copy link

@eddyerburgh i have time now, i can probb figure that out, and make one XD

@eddyerburgh
Copy link

@zzz6519003 join parcel slack, we can discuss implementing in the vue channel

@tom76kimo
Copy link

tom76kimo commented Dec 18, 2017

Basically, parcel supports .babelrc. So we just need to have a vue plugin or preset which has capability to transform vue code like vue-loader and put it in .babelrc then it will work, right? This way keeps parcel clean and let the configs of vue be scoped in vue preset/plugin. Do we have to add native support for vue?

@eddyerburgh
Copy link

@tom76kimo we can't use babel alone to compile Vue single file components(SFCs), since they are not valid JavaScript/ JSX and can't be parsed by babylon.

We either need to add support to parcel core, or create a parcel plugin, like https://github.com/lc60005457/parcel-plugin-vue.

@tom76kimo
Copy link

@eddyerburgh I see. Thanks.

@shawwn
Copy link
Contributor

shawwn commented Jan 4, 2018 via email

@znck
Copy link

znck commented Jan 17, 2018

Update:

vue-component-compiler is available for dev testing.

npm add https://github.com/vuejs/vue-component-compiler

Waiting for feedback.

@pbastowski
Copy link

Guys, while the devs here keep working on improving parcel support for Vue, if you want zero configuration, you should also check out vue-cli 3. It provides zero config for VueJs at its best.

@roblav96
Copy link

@pbastowski That's perfect timing cause I just bailed on trying to get Vue working with parcel bundler. Thanks!

@swift1911
Copy link

Is there any planning to release the Vue support?

@DeMoorJasper
Copy link
Member

@shawwn Any progress?

@padcom
Copy link

padcom commented Feb 25, 2018

I suggest going with POI or vue-cli if proper Vue support is needed. Those are projects strictly targeted at Vue developers.

@scriptPilot
Copy link

Mhm, what a pity in my point of view ... Vue.js has a fast growing community and should be more essentiell in Parcel than others already included ... like json5 eg. So, what is the difficulty, how can we support?

@DeMoorJasper
Copy link
Member

Anyone who feels like it's taking too long, feel free to dive into the branch started by Shawwn, it should be near finished, except for some cleanup and points probably already mentioned in here as response to his example.
Or feel free to get inspiration from it and/or start over from current master.

https://github.com/parcel-bundler/parcel/tree/vue

cc @scriptPilot

@parcel-bundler parcel-bundler deleted a comment Feb 26, 2018
@roblav96
Copy link

@DeMoorJasper Idk why it wasn't merged back in January. You're only digging yourself deeper in technical debt.

@shff
Copy link

shff commented Feb 27, 2018

I believe @shawwn mentioned on Slack that Parcel needed Pug/Jade support before he could continue with this branch. It is being added in #769.

For those wanting to use the latest Parcel version, I'm using https://github.com/BoltDoggy/parcel-plugin-vue in one of my projects and everything seem to work fine. No issues so far, apart from the fact it has to inject CSS using JS, instead of compiling into CSS files.

@laosb
Copy link

laosb commented Mar 1, 2018

Actually I have published a version based on Vue branch with removal of adding unnecessary dependencies on npm, called parcel-bundler-vue. Try it if you need.

@laosb laosb mentioned this issue Mar 7, 2018
@devongovett devongovett added this to the v1.7.0 milestone Mar 9, 2018
@DeMoorJasper DeMoorJasper mentioned this issue Mar 23, 2018
5 tasks
@marcelkorpel
Copy link

Is it correct that at the moment the Vue branch doesn't create a correct build? I tried opening shawwn's proof of concept (which still needed vue as a dependency, but that doesn't change the case) using the vue branch as well as Iaosb's parcel-bundler-vue, but all I got is the contents of index.html in my live tree.

@devongovett
Copy link
Member

Current Vue work is on #1052. It is very much WIP, but feel free to try it out. The more apps we test it against the better.

@devongovett
Copy link
Member

#1052 is now merged, and will be released as part of v1.7.0 later this week! 🎉

@volumia
Copy link

volumia commented Apr 9, 2018

Is it just me, or due CSS modules not work as expected?

Like in this case for example:

// box.vue
<style module>
  .box {
    border: 1px solid black;
  }
</style>

// other_box.vue
<style module>
  .box {
    background-color: gray;
  }
</style>

It just doesn't work. Am I missing something or is this just not implemented yet?

@andrewbanchich
Copy link

@fraf I am guessing it doesn't work since it looks like modules are a vue-loader thing. The scoped keyword works for me since that's part of Vue itself.

@DeMoorJasper
Copy link
Member

@frarf If you'd like to see this feature added, probably best to open up a seperate issue.

@PierBover
Copy link

Anyone knows if relative URLs of images in the <style> part of the component work?

So far everything is working for me except that. More info in this issue.

@Mouvedia
Copy link

@PierBover does it already support the ~ prefix used by @import?

@PierBover
Copy link

@Mouvedia apparently yes, but in the case of URLs of images in CSS of Vue components it doesn't seem to have any effect.

@burlesona
Copy link

@frarf I'm running into a similar problem that styles just don't work, for example the following produces no CSS in the browser.

<style lang="scss">
  .foo {
    color: red;
  }
</style>

There are no errors or anything else, and everything else about the vue components works as expected. Did you figure out a workaround or more helpfully how to debug this sort of thing? I'd love to investigate what's going on and contribute back a fix (if there is one), but I'm not even sure where to start...

@rambo-panda
Copy link

like #2199

padmaia pushed a commit that referenced this issue Jun 5, 2020
Fix tests

Approved-by: Maia Teegarden
AGawrys pushed a commit that referenced this issue Dec 7, 2020
Live reexports fix

Approved-by: Maia Teegarden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests