简体   繁体   中英

Getting error when import instanceMethods function in Sequelize

I have created inside a file a function and export it using

export function foo(params...) {
 // do something
}

inside the initialization of the model I import the function in this way:

import { foo } from "../path/..."

instanceMethods: {
  foo: foo
}

the problem is the model is not initialized correctly. Do you know why?

the problem is the model is not initialized correctly

The following code works fine .

export function foo(params...) { // do something }

import { foo } from "./foo";

let instanceMethods = {
  foo: foo
};

Error is elsewhere. Perhaps you meant to use = and used : ? Note that if you don't use the variable it is erased form the output ( ref ).

@)-'--

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM