feat: Add sourceRoots to Static struct in types.go
This commit is contained in:
parent
681b3f9514
commit
fc1f80e0f5
3 changed files with 6 additions and 2 deletions
|
|
@ -98,6 +98,7 @@ type Moapi struct {
|
|||
// Static setting
|
||||
type Static struct {
|
||||
Rewrite []map[string]string `json:"rewrite,omitempty"`
|
||||
SourceRoots map[string]string `json:"sourceRoots,omitempty"`
|
||||
}
|
||||
|
||||
// AppStorage 应用存储
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ func (r *Request) MakeCache() (*core.Cache, int, error) {
|
|||
}
|
||||
|
||||
// Backend script
|
||||
script, err := core.LoadScript(r.File)
|
||||
script, err := core.LoadScript(r.File, true)
|
||||
if err != nil {
|
||||
return nil, 500, fmt.Errorf("script error, please re-complie the page %s", err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/yaoapp/gou/application"
|
||||
v8 "github.com/yaoapp/gou/runtime/v8"
|
||||
"github.com/yaoapp/gou/runtime/v8/bridge"
|
||||
"github.com/yaoapp/yao/share"
|
||||
)
|
||||
|
||||
// Scripts loaded scripts
|
||||
|
|
@ -81,6 +82,8 @@ func LoadScript(file string, disableCache ...bool) (*Script, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
v8script.SourceRoots = share.App.Static.SourceRoots
|
||||
|
||||
script := &Script{Script: v8script}
|
||||
chScript <- &scriptData{base, script, saveScript}
|
||||
return script, nil
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue