![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
nanachi-cli
Advanced tools
以React方式高效开发小程序
这只是anu的一个扩展,通过实现不同的render,以支持在微信小程序,百度小程序,支付宝小程,快应用,H5, hybird上运行。
npm
npm install nanachi-cli -g
yarn
yarn global add nanachi-cli
<project-name>
创建工程cd <project-name> && npm i
安装依赖nanachi watch:[wx|bu|ali|quick]
监听构建小程序nanachi build:[wx|bu|ali|quick]
构建小程序注意:快应用下构建结束后,需要执行以下三步骤
详见 https://rubylouvre.github.io/nanachi/index.html 或 https://github.com/RubyLouvre/anu/tree/master/packages/render/miniapp
const nanachi = require('nanachi-cli');
nanachi({
/**
* @Boolean
* 是否使用watch模式,默认值:false
*/
watch,
/**
* @Enum ['wx', 'ali', 'bu', 'tt', 'quick']
* 平台,默认值:wx
*/
platform,
/**
* @Boolean
* 是否使用线上beta核心库,默认值:false
*/
beta,
/**
* @Boolean
* 是否使用最新schnee-ui,默认值:false
*/
betaUi,
/**
* @Boolean
* 是否使用压缩模式,默认值:false
*/
compress,
/**
* @Object
* 压缩图片参数(压缩率等)
*/
compressOption,
/**
* @Boolean
* 是否是huawei平台,默认值:false
*/
huawei,
/**
* @Array
* 自定义预处理loaders,默认值:[]
*/
prevLoaders,
/**
* @Array
* 自定义后处理loaders,默认值:[]
*/
postloaders,
/**
* @Array
* 自定义添加webpack module.rules规则,默认值:[]
*/
rules,
/**
* @Array
* 自定义webpack插件,默认值:[]
*/
plugins,
/**
* @function complete
* 解析完成回调
* (err, result) => { }
* err: 错误
* result: webpack打包信息
*/
complete
});
/**
* compressOption:
* {
* jpg: {} // 具体参考 https://github.com/imagemin/imagemin-mozjpeg/blob/master/readme.md
* png: {} // 具体参考 https://github.com/imagemin/imagemin-optipng/blob/master/readme.md
* gif: {} // 具体参考 https://github.com/imagemin/imagemin-gifsicle/blob/master/readme.md
* svg: {} // 具体参考 https://github.com/imagemin/imagemin-svgo/blob/master/readme.md
* }
*/
用户可以使用nanachi api编译nanachi应用,同时支持自定义预处理loader和后处理loader。
compress压缩模式就是使用后处理loader实现的,链接:https://www.npmjs.com/package/nanachi-compress-loader
我们规定了loader的输入和输出格式
{
queues: // 需要生成的文件数组,如nanachi中的js文件在微信转义中会同时生成wxml和js文件还有可能生成json文件
[{
code, // 生成文件内容
type, // 生成文件类型
path // 生成文件相对路径
}],
exportCode // 标准js代码,包含了文件的依赖信息,用于webpack解析文件依赖
}
自定义loader应用到项目中,有两种方式供选择:
// nanachi.config.js
module.exports = {
postLoaders: ['nanachi-compress-loader']
}
正常运行nanachi命令,即可将自定义配置应用到项目中
npm install nanachi-compress-loader --save-dev
nanachi build
// build.js
const nanachi = require('nanachi-cli');
nanachi({
platform: 'ali',
postLoaders: ['nanachi-compress-loader']
});
node build.js
FAQs
cli tool for nanachi
We found that nanachi-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.