$ nice [-c] [nice.config.js]
nej 模块化方式组织的代码路径,以下称源码,填写绝对路径
转换后代码的期望输出路径,填写绝对路径
模式选择,可选值: "1", "2"
- ES5(Default)
- ES6
对应 nej 中的 路径配置(https://github.com/genify/nej/blob/master/doc/DEPENDENCY.md#路径配置)
alias: {
lib: path.resolve(__dirname, 'nej-nej')
}
当解析器识别到脚本 a.js 的依赖路径中有 lib
变量,会将 lib
转换成真实路径,再计算该真实路径相对 a.js 的路径
注: 尽可能填写真实的绝对路径
outputAlias: {
nej: path.resolve('./nej-nej')
}
当转换器识别到脚本 a.js 的依赖的真实路径中存在 path.resolve('./nej-nej') 时,会替换为别名 nej-nej
注: 尽可能填写真实的绝对路径
进行处理的文件扩展名,默认 ['.js']
不进行转换处理的文件,格式别写规则查看 minimatch
ignoreFiles: ['*.es6']
对应 nej 的 平台适配系统。
设置为 true 会将 patch 包带上。默认 false。
nej 的模块化方案,无法直接使用 umd 兼容方案的包,所以我们经常会做一份兼容,如:
defien([
'pro/xx/xx/regular'
], function(R) {
new Regular()
})
而转换后,regularjs 我们将使用 npm 上的包,所以期望的是将 'R' 转换成真实的 regularjs 使用对象 Regular。
那么我们可以如下配置:
replaceArgs: {
'pro/xx/xx/regular': 'Regular'
}