esbuild-plugin-vue3 icon indicating copy to clipboard operation
esbuild-plugin-vue3 copied to clipboard

Plugin does not work. Produces incorrect `import` path

Open or9 opened this issue 9 months ago • 0 comments
trafficstars

Source:

<script type="module">
import { createApp, ref } from "vue";
import "vuetify/styles";
import { createVuetify } from "vuetify";
import * as components from "vuetify/components";
import * as directives from "vuetify/directives";
import VueApp from "../VueApp/VueApp.vue";

const vuetify = createVuetify({
	components,
	directives,
});

createApp({
		setup() {
			return;
		}
	})
	.use(vuetify)
	.mount(`#root`);

</script>

Expected output:

import script from "./VueInit/VueInit.vue?type=script";
import { render } from "./VueInit.vue?type=template";
script.render = render;
script.__file = "./VueInit.vue";
var VueInit_default = script;
export {
  VueInit_default as default
};

Actual output:

import script from "/Users/…/…/…/…/src/…/…/VueInit/VueInit.vue?type=script";
import { render } from "/Users/…/…/…/…/src/…/…/VueInit/VueInit.vue?type=template";
script.render = render;
script.__file = "src/static/components/VueInit/VueInit.vue";
var VueInit_default = script;
export {
  VueInit_default as default
};

(full filesystem path replaced with "…" per segment)

import paths should not be changed unnecessarily, and should definitely not resolve to filesystem paths. If tsconfig is required to make base functionality work, that should be indicated in the documentation. This is not a typescript application, and there are no additional plugins for this build.

Other esbuild builds work fine. It's just this plugin which does not work.

or9 avatar Jan 22 '25 22:01 or9