egoist/esbuild-plugin-vue

Thank you! It works with Yarn2+ (pnp), workspaces, typescript, vue3

Closed this issue · 0 comments

We were really stuck on how to get a project with Yarn 2+, with plug-n-play, complete with workspaces, typescript, and all the sweet hookups, working with esbuild and Vue3. This was the plugin that did it!

Our resulting scripts/build.js was something like this:

const vue = require('esbuild-plugin-vue').default;
const { pnpPlugin } = require('@yarnpkg/esbuild-plugin-pnp');
const esbuild = require('esbuild');

  esbuild
    .build({
      bundle: true,
      // This order is important!!
      plugins: [pnpPlugin(), vue()],
      // This loader was needed because otherwise we ran into "Do not know how to load path: pnp:/.../App.vue"
      loader: {
        '.vue': 'vue'
      },
      entryPoints: ['src/main.ts'],
      outdir: 'dist'
    })
    .catch(() => process.exit(1));