【发布时间】:2020-03-18 10:05:15
【问题描述】:
我的 .js 文件中有这些导出:
export const title = 'Message \n + one';
export const placeHolder = 'Message two';
export default data; //array
然后我将它导入到我想使用它的文件中:
import data, { placeHolder, title } from '../components/data/event-data';
但“标题”带有下划线
title not found in '../components/data/event-data'(import/named)
为什么? 提前谢谢你
【问题讨论】:
-
您确定不是缓存问题吗?从您的导出语句中,命名导出
placeHolder和title都应该可用:) -
您使用的是github.com/benmosher/eslint-plugin-import 还是类似的?这看起来像是一个 linting 错误,并且 linter 或插件可能有错误。
-
谢谢。解决了。同时缓存 eslint 规则。
标签: javascript ecmascript-6 es6-modules