Skip to content

Commit

Permalink
fix: fix win system dynamicImport error
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Nov 9, 2020
1 parent 1093ec3 commit a90d93f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
21 changes: 0 additions & 21 deletions build/vite/cdn.ts

This file was deleted.

5 changes: 4 additions & 1 deletion build/vite/plugin/dynamicImport/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const dynamicImportTransform = function (env: any = {}): Transform {
return {
test({ path }) {
// Only convert the file
return path.includes('/src/utils/helper/dynamicImport.ts');
return (
path.includes('/src/utils/helper/dynamicImport.ts') ||
path.includes(`\\src\\utils\\helper\\dynamicImport.ts`)
);
},
transform({ code }) {
const { VITE_DYNAMIC_IMPORT } = env;
Expand Down
1 change: 1 addition & 0 deletions src/utils/helper/dynamicImport.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// The content here is just for type approval. The actual file content is overwritten by transform
export default function (id: string) {
const dynamicImportModule: any = id;
return dynamicImportModule;
Expand Down
1 change: 0 additions & 1 deletion src/utils/helper/routeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export function genRouteModule(moduleList: AppRouteModule[]) {
}

// 动态引入
// TODO 错误写法
function asyncImportRoute(routes: AppRouteRecordRaw[] | undefined) {
if (!routes) return;
routes.forEach((item) => {
Expand Down
10 changes: 9 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6944,7 +6944,7 @@ rollup@^1.31.1:
"@types/node" "*"
acorn "^7.1.0"

rollup@^2.32.1:
rollup@^2.32.1, rollup@^2.33.1:
version "2.33.1"
resolved "https://registry.npmjs.org/rollup/-/rollup-2.33.1.tgz#802795164164ee63cd47769d8879c33ec8ae0c40"
integrity sha512-uY4O/IoL9oNW8MMcbA5hcOaz6tZTMIh7qJHx/tzIJm+n1wLoY38BLn6fuy7DhR57oNFLMbDQtDeJoFURt5933w==
Expand Down Expand Up @@ -8162,6 +8162,14 @@ vfile@^4.0.0:
unist-util-stringify-position "^2.0.0"
vfile-message "^2.0.0"

vite-plugin-cdn@^1.0.0-beta.3:
version "1.0.0-beta.3"
resolved "https://registry.npmjs.org/vite-plugin-cdn/-/vite-plugin-cdn-1.0.0-beta.3.tgz#5846e80debba5e3968169931f5cba86aea5701cd"
integrity sha512-1oepxSSr8rROFhyP93EWVasKHAAbGfp3QyUrUmJW/zU80CvFPyHATckk8vy08pMiulErSqATjfofTJ+TxP4wkw==
dependencies:
lodash "^4.17.20"
rollup "^2.33.1"

vite-plugin-html@^1.0.0-beta.2:
version "1.0.0-beta.2"
resolved "https://registry.npmjs.org/vite-plugin-html/-/vite-plugin-html-1.0.0-beta.2.tgz#f30cdba4ca70469e62b770e32c407ce5d7f9b544"
Expand Down

0 comments on commit a90d93f

Please sign in to comment.