Skip to content

Commit

Permalink
feat: support specify mako's path with MAKO_PATH env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Jan 7, 2025
1 parent dbf33f8 commit ade4b93
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/bundler/bundler_mako.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { BuildParams } from '@umijs/mako';
import assert from 'assert';
import proxy from 'express-http-proxy';
import fs from 'fs-extra';
import { getPort } from 'get-port-please';
import { createProxyMiddleware } from 'http-proxy-middleware';
import { Mode } from '../types/index.js';
Expand Down Expand Up @@ -54,7 +55,16 @@ export default {
config.cjs = true;
}

const mako = await import('@umijs/mako');
let mako;
if (process.env.MAKO_PATH) {
assert(
fs.existsSync(process.env.MAKO_PATH),
'MAKO_PATH is not a valid path',
);
mako = await import(process.env.MAKO_PATH);
} else {
mako = await import('@umijs/mako');
}
await mako.build({
config,
root: cwd,
Expand Down

0 comments on commit ade4b93

Please sign in to comment.