I am trying to import external JS function from separate file into my Vue.js app which is running on TypeScript.
products_table.js
function init_products_table() {
console.log('test')
}
export {init_products_table as initProductsTable}
And I import it into my Vue component like this:
import { initProductsTable } from '../../products_table.js'
And I get this compile error:
TS7016: Could not find a declaration file for module '../../products_table.js'.
First if you use TS with Vue.JS you should enable JS in your 'tsconfig.json' file. After some recommendation:
If the problem persists please let me know.
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.