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 // build aliases dynamically
const aliasOptions = { resolve: ['.ts'] } const aliasOptions = { resolve: ['.ts'] }
fs.readdirSync(packagesDir).forEach(dir => { fs.readdirSync(packagesDir).forEach(dir => {
if ( if (fs.statSync(path.resolve(packagesDir, dir)).isDirectory()) {
!dir.startsWith('vue') && const name = dir === `vue` ? dir : `@vue/${dir}`
fs.statSync(path.resolve(packagesDir, dir)).isDirectory() aliasOptions[name] = path.resolve(packagesDir, `${dir}/src/index`)
) {
aliasOptions[`@vue/${dir}`] = path.resolve(packagesDir, `${dir}/src/index`)
} }
}) })
const aliasPlugin = alias(aliasOptions) const aliasPlugin = alias(aliasOptions)

View File

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