Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mako config #12366

Merged
merged 2 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/preset-umi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@umijs/ast": "workspace:*",
"@umijs/babel-preset-umi": "workspace:*",
"@umijs/bundler-esbuild": "workspace:*",
"@umijs/bundler-mako": "0.4.14",
"@umijs/bundler-utils": "workspace:*",
"@umijs/bundler-vite": "workspace:*",
"@umijs/bundler-webpack": "workspace:*",
Expand Down
40 changes: 40 additions & 0 deletions packages/preset-umi/src/features/mako/mako.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import path from 'path';
import { IApi } from '../../types';
import { chalk } from '@umijs/utils';

export default (api: IApi) => {
api.describe({
key: 'mako',
config: {
schema({ zod }) {
return zod.object({});
},
},
enableBy: api.EnableBy.config,
});

api.modifyConfig((memo) => {
return {
...memo,
mfsu: false,
hmrGuardian: false,
};
});

api.onStart(() => {
process.env.OKAM = process.env.OKAM || require.resolve('@umijs/bundler-mako');
try {
const pkg = require(path.join(
require.resolve(process.env.OKAM),
'../package.json',
));
api.logger.info(`Using mako@${pkg.version}`);
const isBigfish = process.env.BIGFISH_INFO;
if (!isBigfish) {
api.logger.warn(chalk.yellow(chalk.bold(`Mako is an extremely fast, production-grade web bundler based on Rust. And it's still under active development and is not yet ready for production use. If you encounter any issues, please checkout https://makojs.dev/ to join the community and report the issue.`)));
}
} catch (e) {
console.error(e);
}
});
};
1 change: 1 addition & 0 deletions packages/preset-umi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default () => {
require.resolve('./features/webpack/webpack'),
require.resolve('./features/swc/swc'),
require.resolve('./features/ui/ui'),
require.resolve('./features/mako/mako'),
require.resolve('./features/hmrGuardian/hmrGuardian'),
require.resolve('./features/routePreloadOnLoad/routePreloadOnLoad'),

Expand Down
Loading
Loading