I have such a package with the following structure
index.js
import apiList from "./interface"
const install = Vue => {
if (install.installed)
return;
install.installed = true
Object.defineProperties(Vue.prototype, {
api: {
get() { return apiList }
}
})
}
export default install
when I introduce the package like this, it can run normally
import api from "@/assets/js/http/index"
but that won"t work
import api from "@/assets/js/http"
doesn"t it mean that webpack introduces the package name and automatically looks for the main field of index.js or package.json?
but what"s the problem with introducing the package name "@ / assets/js/http"
invalid directly here?