小编Sha*_*bir的帖子

语法错误:无法在模块外部使用 import 语句

当我尝试在 VSC 中运行调试器时,我不断收到此错误消息。有人可以帮忙吗?这是一个屏幕截图:

我对编程和课程还很陌生,请尽可能让解释保持非常基本的内容。

在此输入图像描述

这是 JS 文件的代码。我使用 Yo Code 和 NPM 生成了一个基本的 Visual Studio 代码扩展。

    // The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import { commands, window } from 'vscode';

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed

/**
 * @param {vscode.ExtensionContext} context
 */
function activate(context) {

// …
Run Code Online (Sandbox Code Playgroud)

javascript visual-studio-code vscode-debugger

8
推荐指数
1
解决办法
1万
查看次数