modify node build module
This commit is contained in:
parent
cbdc69f983
commit
f105736611
@ -3,4 +3,5 @@
|
||||
# ttf 模块node端组件导出程序
|
||||
|
||||
edp build --config ./edp-build-config-node.js --force
|
||||
|
||||
echo "asset path:../fonteditor-ttf/lib"
|
||||
|
@ -38,6 +38,7 @@ exports.getProcessors = function () {
|
||||
'common/DataStore.js',
|
||||
'common/observable.js',
|
||||
'common/promise.js',
|
||||
'common/getPixelRatio.js',
|
||||
'editor/**',
|
||||
'fonteditor/**',
|
||||
'render/**',
|
||||
|
@ -13,6 +13,13 @@ var REG_TOP_MODULE = /^(:?common|math|graphics|ttf)/;
|
||||
|
||||
var REG_REQUIRE = /require\(\s*(['"])([^'"]+)\1\s*\)/g;
|
||||
|
||||
// dep配置模块,替换成dep的地址
|
||||
var REG_DEP_MODULE = /^(:?ClipperLib)/;
|
||||
|
||||
// 相对于lib目录的dep目录
|
||||
var DEP_PARH = '../dep/';
|
||||
|
||||
|
||||
/**
|
||||
* 获取ast树
|
||||
* @param {string} code 代码片段
|
||||
@ -184,7 +191,11 @@ function replaceDefine(code) {
|
||||
*/
|
||||
function replaceRequire(code, codeDepth) {
|
||||
return code.replace(REG_REQUIRE, function ($0, $1, moduleId) {
|
||||
if (REG_TOP_MODULE.test(moduleId)) {
|
||||
|
||||
if (REG_DEP_MODULE.test(moduleId)) {
|
||||
moduleId = codeDepth + DEP_PARH + moduleId;
|
||||
}
|
||||
else if (REG_TOP_MODULE.test(moduleId)) {
|
||||
moduleId = codeDepth + moduleId;
|
||||
}
|
||||
return 'require(\'' + moduleId + '\')';
|
||||
|
Loading…
x
Reference in New Issue
Block a user