parcel-bundler / parcel

The zero configuration build tool for the web. πŸ“¦πŸš€
https://parceljs.org
MIT License
43.42k stars 2.26k forks source link

Parcel 2: Vue custom blocks not supported #6257

Open mjog opened 3 years ago

mjog commented 3 years ago

πŸ› bug report

It seems that Vue custom blocks aren't working in Parcel 2, since when trying to use vue-i18n, I can't use <i18n> blocks in single file components.

πŸŽ› Configuration (.babelrc, package.json, cli command)

package.json:

  "dependencies": {
    "vue": "^3.0.11",
    "vue-i18n": "^9.1.6"
  },
  "devDependencies": {
    "@parcel/config-default": "^2.0.0-beta.2",
    "@parcel/transformer-js": "^2.0.0-beta.2",
    "@parcel/transformer-raw": "^2.0.0-beta.2",
    "@parcel/transformer-vue": "^2.0.0-beta.2",
    "parcel": "^2.0.0-beta.2"
  }

πŸ€” Expected Behavior

Able to use vue-i18n

😯 Current Behavior

🚨 Build failed.
@parcel/transformer-vue: No preprocessor found for block type i18n

πŸ’ Possible Solution

🀷

πŸ”¦ Context

vue-i18n's <i18n> blocks are needed for proper compartmentalisation of i18n resources in a Vue app.

πŸ’» Code Sample

See vue-i18n's docs in link above.

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-beta.2
Node v12.21.0
pnpm 6.2.5
Operating System Ubuntu 21.04
101arrowz commented 3 years ago

If you look at the docs, you'll see that Parcel does indeed support custom Vue blocks, but they are a different style to the way it's done in Webpack. If you look at the tutorial for adding vue-i18n to Webpack, you need to install vue-i18n-loader to use it there. You'll need to port that package over to the Parcel preprocessor format to get this working.