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

bug of switching vue version with pnpm #92

Closed
jackson-yyy opened this issue Aug 13, 2021 · 0 comments · Fixed by #93
Closed

bug of switching vue version with pnpm #92

jackson-yyy opened this issue Aug 13, 2021 · 0 comments · Fixed by #93

Comments

@jackson-yyy
Copy link
Contributor

demo:
https://github.com/jackson-yyy/vue-demi-bug-demo

reproduce steps

  1. run pnpm install
  2. check node_modules/lib/v3/index.cjs, it is correct.
var Vue = require('vue')

Object.keys(Vue).forEach(function(key) {
  exports[key] = Vue[key]
})
  1. run pnpm switch:vue2
  2. check node_modules/lib/v3/index.cjs, it becomes the source code of v2. it shouldn't be changed.
var Vue = require('vue')
var VueCompositionAPI = require('@vue/composition-api')

i think it's the problem of pnpm. It use symbol link to link file.

i try to delete files under lib before writing file

function copy(name, version, vue) {
  vue = vue || 'vue'
  const src = path.join(dir, `v${version}`, name)
  const dest = path.join(dir, name)
  let content = fs.readFileSync(src, 'utf-8')
  content = content.replace(/'vue'/g, `'${vue}'`)
+ fs.unlinkSync(dest)
  fs.writeFileSync(dest, content, 'utf-8')
}

it works perfectly now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant