함수 파일에서 하나의 함수를 가져 오려고합니다. 함수 파일은 다음과 같습니다.개체에서 속성 가져 오기
const Functions = {
url(path = '') {
path = path.replace(/^\/+/, '');
return `${document.baseURI}/${path}`;
},
asset(path = '') {
return this.url(path);
}
};
export default Functions;
그런 다음 url
같은 기능을 가져 오십시오.
import {url} from "../Utils/Functions";
이렇게하면 browserify에서 브라우저에 다음 오류가 발생합니다. url
이 Functions
객체에서와 같이
Uncaught TypeError: (0 , _Functions.url) is not a function
는 MDN 문서에 따르면,이 가져 오기가 작동합니다.
내가 뭘 잘못하고 있니?
.. '가져 오기 url from "../Utils/Functions"; "당신을 위해 작동합니다 –