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

h5 版本缺少配置文件 #16

Open
vincentmrlau opened this issue Jun 4, 2018 · 5 comments
Open

h5 版本缺少配置文件 #16

vincentmrlau opened this issue Jun 4, 2018 · 5 comments

Comments

@vincentmrlau
Copy link

请问这个配置文件应该怎么写?
Error: Cannot find module '/Users/liuyiman/learnspace/athena2/h5/config'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at exports.getAppBuildConfig (/Users/liuyiman/privatespace/athena2/src/build/index.js:57:23)
at serveCore (/Users/liuyiman/privatespace/athena2/src/build/serve.js:48:23)
at serveApp (/Users/liuyiman/privatespace/athena2/src/build/serve.js:184:5)
at serve (/Users/liuyiman/privatespace/athena2/src/build/serve.js:32:7)
at Object. (/Users/liuyiman/privatespace/athena2/bin/tfe-serve:26:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)

@luckyadam
Copy link
Member

可以发下项目目录么~

@vincentmrlau
Copy link
Author

用ath2 a生成的,没有使用h5 template

.
├── app.conf.js
├── jsconfig.json
├── node_modules
│   └── preloader.js
│       ├── LICENSE
│       ├── README.md
│       ├── README_CN.md
│       ├── package.json
│       └── src
│           └── preloader.js
├── package.json
├── src
└── yarn.lock

@vincentmrlau
Copy link
Author

ath2/src/build/index.js 的getAppBuildConfig方法改一下就可以了

exports.getAppBuildConfig = function (appPath) {
  const buildConfig = (() => {
    const configPath = path.join(appPath, 'config')
    if (fs.existsSync(configPath)) {
      return require(configPath)(_.merge)
    }
    return {}
  })()
  const defaultConfig = require('../config/build.conf')
  return _.merge(defaultConfig, buildConfig)
}

@luckyadam
Copy link
Member

奇怪,没有生成 config 目录么。。
能不能提个PR呢

@vincentmrlau
Copy link
Author

可以

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

2 participants