简体   繁体   English

如果存在从xxx导入xxx,我将无法在单个.js文件中运行

[英]I can not run in the single `.js` file, if there is the `import xxx from xxx`

I can not run in the single .js file, if there is the import xxx from xxx . 如果存在import xxx from xxx ,则无法在单个.js文件中运行。

在此处输入图片说明

I use the single file to debug the imported ts_config , how can I do this in WebStorm? 我使用单个文件调试导入的ts_config ,如何在WebStorm中执行此操作?


EDIT-1 编辑1

The configuration choices are bellow: 配置选项如下:

在此处输入图片说明

Tell me how to do with this? 告诉我该怎么做?

You are using older version of nodejs and import keyword is not supported in v6.6. 您使用的是旧版本的nodejs ,而nodejs不支持import关键字。 Please use version 8 or above for import keyword to work without using any transpiler like babel. 请使用版本8或更高版本的import关键字来工作,而无需使用任何翻译工具,例如babel。

The functionality you are trying to use is part of the ES Modules specification. 您尝试使用的功能是ES Modules规范的一部分。

However, ES Modules are NOT stable in Node.js as of version v9.9.0 , and should not be used in production. 但是,从v9.9.0版本v9.9.0ES ModulesNode.jsv9.9.0 ,因此不应在生产中使用。 This functionality is under development, and expected to be stable-released with Node.js v10.0.0 . 此功能正在开发中,预计将随Node.js v10.0.0一起稳定发布。

Right now, you can do: 现在,您可以执行以下操作:

const ts_config = require('./tsconfig.json);

Are you exporting your tsConfig? 您要导出tsConfig吗?

export default
{
  // json here...
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在反应中将我的导入缩短为“@dir/subdir/file”中的 import xxx - how can i shorten my imports as import xxx from “@dir/subdir/file” in react Typescript导入一个React js组件,该组件由我自己编写并出现了d.ts文件。找不到模块:无法解析“ xxx”中的“ xxx” - Typescript import a React js component which d.ts file writed by myself and occured Module not found: Can't resolve 'xxx' in 'xxx' 将js编号转换为xxx xxx xxx,xx? - convert js number to xxx xxx xxx ,xx? 无法从默认导出模块导入命名导出“XXX”(导入为“XXX”)(仅默认导出可用) - Can't import the named export 'XXX' (imported as 'XXX') from default-exporting module (only default export is available) 在 JS 中获取“xxx 不是函数” - getting “xxx is not a function” in JS if(xxx || xxx),我做错了什么? - if(xxx || xxx), what am I doing wrong? 奇怪的node.js运行时错误:XXX不是一个函数(但是我确实将XXX定义为一个函数〜!) - Strange node.js runtime error: XXX is not a function (But I indeed define XXX as a function~!) 我可以在 Node.js 和 Express 中运行 single.js 文件吗? - Can I run a single .js file in Node.js and Express? javascript - function.prototype.XXX,我可以理解为OOP类静态属性/成员XXX吗? - javascript - function.prototype.XXX , can I understand it as OOP Class static property/member XXX? Wordpress 插件中“XXX.min.js”文件的意义 - Significance of 'XXX.min.js' file in Wordpress plugin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM