Nuxt UI Pro 编译破解
Nuxt 已经被 Vercel 收购,并且后续会开源 Pro 组件。
验证方法调用位置:node_modules\@nuxt\ui-pro\dist\module.mjs
nuxt.hook("build:before", async () => {
await validateLicense({ key, theme: theme$1, dir: nuxt.options.rootDir });
});
点进validateLicense
方法,发现位置在node_modules\@nuxt\ui-pro\dist\shared\ui-pro.CsgJ05mi.mjs
这样一个文件中
注释掉该方法内容,并添加成功返回:
async function validateLicense(opts) {
// if (!opts.key) {
// throw _createError(`Missing \`${opts.theme.env}\` license key.
// Purchase Nuxt UI Pro at \`${opts.theme.link}\` to build your app in production.`);
// }
// const gitInfo = opts.key !== "oss" ? void 0 : await _getLocalGitInfo(opts.dir) || _getGitEnv();
// const projectName = gitInfo ? `${gitInfo.owner || ""}/${gitInfo.name || ""}` : await _getPkgName(opts.dir);
// try {
// await ofetch("https://api.nuxtlabs.com/ui-pro/verify", {
// headers: {
// "Authorization": `key ${opts.key}`,
// "x-nuxt-project": projectName
// },
// params: gitInfo ? {
// gitRepo: gitInfo.name,
// gitOrg: gitInfo.owner,
// gitUrl: gitInfo.url
// } : {}
// });
// } catch (error) {
// const statusType = Math.round(error.status / 100);
// if (statusType === 4) {
// throw _createError(`Invalid \`${opts.theme.env}\` license key.
// Purchase Nuxt UI Pro at \`${opts.theme.link}\` to build your app in production.`);
// }
// throw _createError("Cannot validate Nuxt UI Pro License: " + error);
// }
const response = {
status: 200,
};
return response;
}
然后即可成功 build 了。