Index.html을ES6 모듈 지원, CORS 오류
<html>
<head>
<script type="module">
import {answer} from './code.js'
console.info("It's ${answer()} time!")
</script>
</head>
<body>
</body>
</html>
code.js
export function answer(){
return 'module';
}
Error: Access to Script at 'file:///C:*******/es6/code.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.
크롬은 모듈을 지원할 수 말한다 웹에서 작업하는 예제를 보았지만 다운로드 한 파일을 복사하여 로컬에서 실행하면 항상 위의 오류가 발생합니다. Babel, Webpack 등을 사용하고 싶지 않습니다.
Chrome 및 Chrome Canary에서 실험용 웹 플랫폼 기능 플래그를 사용하도록 설정했습니다.
감사합니다. Alexander !!! 전자를 사용하려고하면 어떤 생각이 들겠습니까? –
@markpavlis 나는 Electron이 그런 보안 제한을 가지고 있지 않다고 생각 하겠지만, 나는 확실히 모른다. –