Custom package import could not find index.js

I have such a package with the following structure

clipboard.png

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?

Jun.24,2022

I also encountered this problem. How to solve it? I would like to ask


'@ / assets/js/http' to find the http.js file when it is addressed. You can try'@ / assets/js/http/'.
node will only be used as a folder when it ends with'/'to find the 'index' file inside.
seems to have a third-party library that can omit this'/ 'directly.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b368e1-2c01c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b368e1-2c01c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?