Skip to content
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

Is it possible to provide macros for vue2.7 that are only aligned to vue3 via Vue Macros #657

Open
3 tasks done
curlykay opened this issue Apr 5, 2024 · 0 comments
Open
3 tasks done
Labels
enhancement New feature or request

Comments

@curlykay
Copy link

curlykay commented Apr 5, 2024

Clear and concise description of the problem

I know that functionally the answer is YES. but I ran into some DX issues in my attempts.
The macros required to align vue2.7 to vue3 are 'defineOptions','defineModel','defineSlots'
image

  1. Can't filter IntelliSense in vscode.
    Some macros (e.g. :defineModels) are turned off on the vue.config.js ,tsconfig.jsonconfiguration, but due to the use of "unplugin-vue-macros/vue2-macros-global",vscode IntelliSense will still prompt.
const { defineConfig } = require('@vue/cli-service');
const VueMacros = require('unplugin-vue-macros/webpack');
module.exports = defineConfig({
  transpileDependencies: true,
  parallel: false,
  configureWebpack: {
    plugins: [
      VueMacros({
        // defineOptions: Options$6,
        // defineProps: Options$8,
        // defineSlots: Options$b,
        betterDefine: false,
        booleanProp: false,
        chainCall: false,
        defineEmit: false,
        defineModels: false,
        defineProp: false,
        definePropsRefs: false,
        defineRender: false,
        exportExpose: false,
        exportProps: false,
        exportRender: false,
        hoistStatic: false,
        jsxDirective: false,
        namedTemplate: false,
        reactivityTransform: false,
        setupBlock: false,
        setupComponent: false,
        setupSFC: false,
        shortBind: false,
        shortEmits: false,
        shortVmodel: false,
      }),
    ],
  },
});
image image

I'm guessing that using 'unplugin-vue-macros/vue2-macros-global' with custom cropping solves the problem

  1. Missing macro 'defineModel' that was added in vue 3.4.
    ps:Forgive me, this point is probably more appropriate as a separate issue.
image

env
vscode 1.8.8
volar 1.8.7(takeover)
macos 14.4.1

repo:https://github.com/curlykay/vue2-macros-vuecli

Suggested solution

How do I configure Vue Macros to make vue2.7 align with vue3 in the dimension of macros? I'd be happy to learn.

Or

Just like the standalone 'unplugin-vue-define-options', would it be possible to provide a standalone 'unplugin-vue-macros-compat' and '@vue-macros-compat/volar' aligned with vue3.

Alternative

No response

Additional context

No response

Validations

@curlykay curlykay added the enhancement New feature or request label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant