Skip to content

Commit

Permalink
fix: paths tsconfig.json
Browse files Browse the repository at this point in the history
  • Loading branch information
richard1015 committed Feb 25, 2021
1 parent 6bf8ef9 commit b7558c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
30 changes: 15 additions & 15 deletions src/nutui.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
export default {
async install(app: any): Promise<void> {
/** webpack */
// const files = require.context('@/packages', true, /index\.vue$/);
// files.keys().forEach(component => {
// const componentEntity = files(component).default;
// app.component(componentEntity.name, componentEntity);
// });
import { version } from '../package.json';
const modules = import.meta.globEager('/src/packages/**/index.vue');
function install(app: any) {
/** webpack */
// const files = require.context('@/packages', true, /index\.vue$/);
// files.keys().forEach(component => {
// const componentEntity = files(component).default;
// app.component(componentEntity.name, componentEntity);
// });

/** vite */
const modules = import.meta.globEager('/src/packages/**/index.vue');
for (const key in modules) {
const componentEntity = modules[key]?.default;
app.component(componentEntity.name, componentEntity);
}
/** vite */
for (const key in modules) {
const componentEntity = modules[key]?.default;
app.component(componentEntity.name, componentEntity);
}
};
}
export default { install, version };
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"compilerOptions": {
"baseUrl": ".",
"rootDir": ".",
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
Expand All @@ -11,7 +13,7 @@
"lib": ["esnext", "dom"],
"types": ["vite/client"],
"paths": {
"@/": ["./src"]
"@/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
Expand Down

0 comments on commit b7558c1

Please sign in to comment.