build: include main vue package in aliases and tsconfig paths

This commit is contained in:
Evan You 2019-10-04 17:36:26 -04:00
parent 277651ce89
commit 8d49b97cc3
2 changed files with 4 additions and 5 deletions

View File

@ -19,11 +19,9 @@ const packageOptions = pkg.buildOptions || {}
// build aliases dynamically
const aliasOptions = { resolve: ['.ts'] }
fs.readdirSync(packagesDir).forEach(dir => {
if (
!dir.startsWith('vue') &&
fs.statSync(path.resolve(packagesDir, dir)).isDirectory()
) {
aliasOptions[`@vue/${dir}`] = path.resolve(packagesDir, `${dir}/src/index`)
if (fs.statSync(path.resolve(packagesDir, dir)).isDirectory()) {
const name = dir === `vue` ? dir : `@vue/${dir}`
aliasOptions[name] = path.resolve(packagesDir, `${dir}/src/index`)
}
})
const aliasPlugin = alias(aliasOptions)

View File

@ -20,6 +20,7 @@
"types": ["jest", "node"],
"rootDir": ".",
"paths": {
"vue": ["packages/vue/src"],
"@vue/shared": ["packages/shared/src"],
"@vue/runtime-core": ["packages/runtime-core/src"],
"@vue/runtime-dom": ["packages/runtime-dom/src"],