vue-macros: Webpack / Vue CLI: `defineOptions is not defined` (production mode)

image

image

dependencies: “vue”: “^3.2.13”, “unplugin-vue-define-options”: “^0.6.1”, ”webpack": “5.70.0”

vue.config.js config: image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 32 (11 by maintainers)

Commits related to this issue

Most upvoted comments

You can set parallel: false in vue.config.js to disable thread-loader.

Related: vuejs/vue-cli#2785 (comment) webpack-contrib/thread-loader#27

You can use parallelize-webpack-unplugin if you have tried this method and it works. It partially simplifies the parameters that unplugin depends on to allow the plugin to support running with thread-loader, so that you can enjoy the benefits of concurrent compilation at the same time.

@qinyang912 Thanks for your feedback! For Vue 2 (Vue loader 15) + Webpack, an additional option is required.

  plugins: [
    defineOptions({
      include: [/\.vue$/, /\.vue\?vue/],
    }),
    new VueLoaderPlugin(),
  ],

I will add it to the documentation later.

@Nstd 有用!

@Nstd 对了,node 版本是 14.19.2npm9.1.1,系统是 Win10 22H2

@ShaneLee-9 需要再加个一个配置: https://github.com/sxzz/unplugin-vue-macros/issues/23#issuecomment-1170283222

请问目前有解决办法了么。同为webpack5报错,显示 defineOptions is not defined

@qq619433305

vue 3 webpack 5 非 TS 使用这个可以:https://github.com/sxzz/unplugin-vue-macros/issues/23#issuecomment-1285433093

   defineOptions({
      include: [/\.vue$/, /\.vue\?vue/],
    })