Parcel 2: Vue transformer
See original GitHub issueCreate the @parcel/transformer-vue
package in packages/transforms/vue
. This package is a Parcel 2 transform plugin for Vue. It should be based on the VueAsset
from Parcel 1.
The @parcel/transformer-vue
package is responsible for the following things:
- Parsing Vue SFCs with
@vue/component-compiler-utils
- Extracting scripts, styles, and templates as child assets
- Compile templates
- Compile CSS modules
- Compile scoped styles
- Insert HMR runtime
- Combine the results into JS and CSS child assets
Additional features above what Parcel 1 offers to consider:
- Support for external script and style tags (#1333)
- Support for CSS source maps (#2721)
- Remove minification from the transformer - it will be handled by the optimizer, and sometimes causes issues like #1183
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:25 (11 by maintainers)
Top Results From Across the Web
@parcel/transformer-vue - npm
Start using @parcel/transformer-vue in your project by running `npm i @parcel/transformer-vue`. There are no other projects in the npm ...
Read more >Vue - Parcel
Parcel supports Vue automatically using the @parcel/transformer-vue plugin. When a .vue file is detected, it will be installed into your project automatically.
Read more >@parcel/transformer-vue NPM | npm.io
Parcel is a compiler for all your code, regardless of the language or toolchain. Parcel takes all of your files and dependencies, transforms...
Read more >parcel-transformer-vue2 - npm package - Snyk
Vue 2 transformer plugin for Parcel 2. Installation. Install this package by npm install parcel-transformer-vue2 --save-dev.
Read more >@parcel/transformer-html | Yarn - Package Manager
Fixed · Update lmdb-js. · Update napi-rs to v2 - Details · Fix SWC targets for older browsers - Details · Add SWC...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Some pointers for whoever interested in working on it:
Vue 3 SFC transform should be using https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc
The docs are non-existent yet, but the types in the source code are pretty self-explanatory. I would also recommend using https://github.com/vuejs/rollup-plugin-vue/tree/next and https://github.com/vuejs/vue-loader/tree/next as references.
The general idea is that the base transform will parse the SFC and rewrite it into JavaScript code that make additional “virtual requests” to the same
*.vue
file but with different query params. These requests would come back to the transform and the transform should parse the query and perform appropriate transforms for each part of the SFC.It doesn’t look like much, but it may be the first vue component build with Parcel 2.
src:
rendered:
Next I’ll be implementing HMR, external blocks, and custom blocks.