我正在尝试在纯JS中使用导入/导出来练习模块,但是遇到了错误。我的应用程序架构是:
在 index.html 内部:
<script type="module" src="app.js">
在 app.js 内部:
import * as ENDPOINTS from './endpoints.js';
在 endpoints.js 内部:
export const ENDPOINTS = {
POSTS : 'https://jsonplaceholder.typicode.com/posts'
}
Chrome浏览器开发工具还看不到 app.js
我的问题是:我如何导入/导出或向<script>
标签添加sth才能使它正常工作?