-1

如何在 ES6 中导入名称中包含特殊字符的文件?

我可以

import { tomorrow} from 'react-syntax-highlighter/dist/esm/styles/hljs';

但我不能:

import { tomorrow-night} from 'react-syntax-highlighter/dist/esm/styles/hljs';

4

1 回答 1

0

JavaScript 不支持变量名中的连字符。它们保留用于减法。

于 2021-10-21T14:47:31.750 回答