element-plus / vue-cli-plugin-element-plus

Element Plus plugin for @vue/cli 4.5
MIT License
126 stars 16 forks source link

Cannot read property 'replace' of undefined [bug fix] #12

Open tnnevol opened 3 years ago

tnnevol commented 3 years ago

不知道是不是官方小伙独爱单引号, 麻烦修改一下正则吧

// ./node_modules/vue-cli-plugin-element-plus/generator/index.js:45:45 bug fix
// edit line 41
// error code
    const renderIndex = lines.findIndex(line => line.match(/createApp\(App\)(\.use\(\w*\))*\.mount\('#app'\)/))
// fix code
    const renderIndex = lines.findIndex(line => line.match(/createApp\(App\)(\.use\(\w*\))*\.mount\(['"]#app['"]\)/))
CoolersCoder commented 3 years ago

I get same issue , 同样的问题+1.

HeliumTang commented 3 years ago

只能等官方修bug了吗?

saltfishh commented 3 years ago

不知道是不是官方小伙独爱单引号, 麻烦修改一下正则吧

// ./node_modules/vue-cli-plugin-element-plus/generator/index.js:45:45 bug fix
// edit line 41
// error code
    const renderIndex = lines.findIndex(line => line.match(/createApp\(App\)(\.use\(\w*\))*\.mount\('#app'\)/))
// fix code
    const renderIndex = lines.findIndex(line => line.match(/createApp\(App\)(\.use\(\w*\))*\.mount\(['"]#app['"]\)/))

似乎还是报错

pollux2015 commented 3 years ago

遇到同样问题

LittleSound commented 3 years ago

这个正则还要求匹配 createApp,如果 createApp 在另外一行就不行了 image

jdinartejesus commented 3 years ago

Can someone create a PR?

dmytropryshliak commented 3 years ago

Does anybody know why is it not merged yet?

censujiang commented 3 years ago

我也遇到相同的问题了 ERROR TypeError: Cannot read property 'replace' of undefined TypeError: Cannot read property 'replace' of undefined at D:\git\sailoudcodegit\unidownpage\node_modules\vue-cli-plugin-element-plus\generator\index.js:45:45 at runGenerator (C:\Users\censujiang\AppData\Roaming\npm\node_modules\@vue\cli\lib\invoke.js:132:13) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async invoke (C:\Users\censujiang\AppData\Roaming\npm\node_modules\@vue\cli\lib\invoke.js:92:3)