![](/img/trans.png)
[英]how can i shorten my imports as import xxx from “@dir/subdir/file” in react
[英]I can not run in the single `.js` file, if there is the `import xxx from xxx`
您使用的是舊版本的nodejs
,而nodejs
不支持import
關鍵字。 請使用版本8或更高版本的import
關鍵字來工作,而無需使用任何翻譯工具,例如babel。
您嘗試使用的功能是ES Modules
規范的一部分。
但是,從v9.9.0
版本v9.9.0
, ES Modules
在Node.js
中v9.9.0
,因此不應在生產中使用。 此功能正在開發中,預計將隨Node.js v10.0.0
一起穩定發布。
現在,您可以執行以下操作:
const ts_config = require('./tsconfig.json);
您要導出tsConfig嗎?
export default
{
// json here...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.