-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
egg 的 scf_bootstrap 是这么写的
const { Application } = require('egg');
// 如果通过层部署 node_modules 就需要修改 eggPath
Object.defineProperty(Application.prototype, Symbol.for('egg#eggPath'), {
value: '/opt',
});
const app = new Application({
mode: 'single',
env: 'prod',
});
// ...如果使用基于 Egg 封装的框架,无法加载上层框架,需要做这样的改动才能加载:
// package.json
"egg": {
"framework": "my-framework"
},// sls.js
const { Application } = require('my-framework');
Object.defineProperty(Application.prototype, Symbol.for('egg#eggPath'), {
value: '/opt/node_modules/my-framework',
});
const app = new Application({
mode: 'single',
env: 'prod',
});
// ...# serverless.yml
# 将 component: egg 改成 component: koa
component: koa
inputs:
entryFile: sls.js
# ......Metadata
Metadata
Assignees
Labels
No labels