Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error when using esbuild #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
Lisheri opened this issue Sep 27, 2024 · 2 comments
Open
5 tasks done

Error when using esbuild #824

Lisheri opened this issue Sep 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Lisheri
Copy link

Lisheri commented Sep 27, 2024

Describe the bug

Using esbuild to build the following components reports errors:

<template>
  <Button>按钮</Button>
</template>
<script setup lang="ts">
import { Button } from 'ant-design-vue';
const a = __DEV__;
console.info(a);
</script>
<style lang="scss" scoped>
.ant-btn {
  background-color: red;
}
</style>
<script lang="tsx">
import { defineComponent } from 'vue';
import { Input } from 'ant-design-vue';
export default defineComponent({
  name: 'ButtonTsx',
  setup(_, { attrs }) {
    return () => <Input {...attrs} />;
  }
});
</script>
<script setup lang="tsx">
const props = withDefaults(defineProps<{}>(), {});
defineRender(() => {
  return <div>content</div>;
});
</script>
<style lang="scss" scoped></style>

plugin script configuration:

import Vue from 'unplugin-vue/esbuild';
import VueJsx from 'unplugin-vue-jsx/esbuild';
import vueMacros from 'unplugin-vue-macros/esbuild';
build({
...
  plugins: [
    vueMacros({
        vue: Vue(),
        vueJsx: VueJsx()
      }),
  ]
})

error messages

image

Other possible situations

It may be a problem caused by unplugin-vue. When using unplugin-vue alone to package only the first component that does not contain tsx, an error is still reported.
However, the problem still cannot be solved by combining.

Reproduction

https://github.com/Lisheri/esbuild_v3_component

System Info

macos: 14.3.1
node: 21.7.1
typescript: 5.6.2
esbuild: 0.24.0

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@Lisheri
Copy link
Author

Lisheri commented Sep 27, 2024

The following is the reply to the esbuild issue

image

@dosubot dosubot bot added the bug Something isn't working label Sep 27, 2024
@Lisheri
Copy link
Author

Lisheri commented Sep 27, 2024

The preliminary processing results of unplugin-vue are as follows, which appear to be normal.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant