Skip to content

No loader configured for ".vue" files with serve #1589

@luopio

Description

@luopio

I have a very simple setup with an example Vue app. Replacing the vue-cli tooling with esbuild was a breeze. Build works fine, but I'm failing to get serve working.

My build script that works just fine (also a version with watch has no issues):

const vuePlugin = require("esbuild-plugin-vue3");
const manifestPlugin = require("esbuild-plugin-manifest");

const BUILD_OPTIONS = {
  entryPoints: ['src/App.vue'],
  bundle: true,
  outfile: 'dist/app.js',
  plugins: [vuePlugin(), manifestPlugin()],
  loader: { '.png': 'binary' },
}

require('esbuild').build(
  BUILD_OPTIONS
).catch(() => process.exit(1))

module.exports = { BUILD_OPTIONS };

My failing serve.js is this:

const { BUILD_OPTIONS } = require("./build");

require('esbuild').serve(
  {
    servedir: 'dist',
    port: 8000,
  },
  BUILD_OPTIONS
  ).then(server => {
    console.log("Server stopped")
    server.stop()
  })

When I run it I get:

$ node serve.js                             
Server stopped
 > error: No loader is configured for ".vue" files: src/App.vue

Any tips would be very much appreciated.

$ ./node_modules/.bin/esbuild --version
0.12.26

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions