0.0.7 • Published 9 months ago

@plugin-light/webpack-loader-replace-vue-key v0.0.7

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

Vue 中 key 转换

替换 Vue 文件key的表示,以解决编译报错。

:key="'type' + index"

转为

:key="`type-${index}`"

如何使用

安装

pnpm add @plugin-light/webpack-loader-replace-vue-key -D

vue.config.js 中添加如下设置:

const { LOADER as replaceVueKey } = require('webpack-loader-replace-vue-key')';

module.export = {
  chainWebpack(config) {
    config.module
      .rule('vue')
      .test(/\.vue$/)
      .use(replaceVueKey)
      .loader(replaceVueKey)
      .end();
  }
}