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

无效文件路径打包未进行提示 #14

Open
zsd881224 opened this issue Sep 1, 2014 · 0 comments
Open

无效文件路径打包未进行提示 #14

zsd881224 opened this issue Sep 1, 2014 · 0 comments

Comments

@zsd881224
Copy link

无效文件路径打包未进行提示

kmc能否提供配置项,在生成依赖关系文件过程中,若依赖文件不存在,给出错误提示并中断构建流程?

  • 事件经过
    1. 8月26日构建某个项目的过程中,由于bower过程错误导致某个依赖包部分文件丢失

    2. 项目build过程中,kmc运行结果中不存在的依赖文件地址被写为绝对路径:

      'pi/overlay/dialog': { requires: ['base', 'node', '/Users/***/work/pi/build/overlay/common.js']}
      
    3. 项目上线后,出现BUG

  • 文件正确情况下生成的依赖关系:
'pi/overlay/common': { requires: ['node', 'overlay', 'dd']},
'pi/overlay/confirm': { requires: ['base', 'node', 'pi/overlay/common']},
'pi/overlay/dialog': { requires: ['base', 'node', 'pi/overlay/common']},
'pi/overlay/index': { requires: ['pi/overlay/alert', 'pi/overlay/confirm', 'pi/overlay/dialog', 'pi/overlay/index.css']}
  • 文件丢失情况下生成的依赖关系
    • 丢失文件为common.js / index.js / confirm.js
'pi/overlay/dialog': { requires: ['base', 'node', '/Users/***/work/pi/build/overlay/common.js']}
  • 反思
    • kmc生成依赖的过程中,若能对不存在文件进行一定的提示,可防止类似情况的发生
  • 附kmc配置
kmc: {
    options: {
        packages     : [
            {
                name                  : 'pi',
                path                  : './build/',
                charset               : 'utf-8',
                ignorePackageNameInUri: true
            }

        ],
        // 生成模块依赖关系表
        depFilePath  : 'build/mods.js',
        comboOnly    : true,
        fixModuleName: true,
        comboMap     : true
    },

    main: {
        files: [
            {
                // 这里指定项目根目录下所有文件为入口文件,自定义入口请自行添加
                expand: true,
                cwd   : './build/',
                src   : [ '**/*.js'],
                dest  : './build/'
            }
        ]
    }
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant