Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "Cannot use import statement outside a module" #1872

Closed
hydroper opened this issue Aug 26, 2022 · 0 comments
Closed

Getting "Cannot use import statement outside a module" #1872

hydroper opened this issue Aug 26, 2022 · 0 comments

Comments

@hydroper
Copy link

Search Terms

There's a similiar issue, #922. However it is closed and the suggested solutions don't work for me.

Expected Behavior

No error.

Actual Behavior

I'm getting:

my-outer-package\node_modules\com.matheusdiasdesouzads.js.language-objects\src\index.ts:1
import Language, {Direction} from './language';
^^^^^^

SyntaxError: Cannot use import statement outside a module

Steps to reproduce the problem

    1. git clone https://github.com/matheusdiasdesouzads/message-locator-js
    1. cd message-locator-js
    1. ts-node src/index.ts

Minimal reproduction

The repository https://github.com/matheusdiasdesouzads/message-locator-js is pretty short and only depends on https://github.com/matheusdiasdesouzads/language-objects-js, which is also short.

Specifications

  • ts-node version: v10.9.1
  • node version: v16.17.0
  • TypeScript version: v4.7.4
  • tsconfig.json, if you're using one:
{
  "compilerOptions": {
    "out": "dist/message-locator.js", 
    "sourceMap": true, 
    "target": "es6",
    "lib": ["es2015", "dom"],
    "noImplicitAny": true
  }
}
  • package.json:
{
  "name": "com.matheusdiasdesouzads.js.message-locator",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.ts",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "matheusdiasdesouzads",
  "repository": "https://github.com/matheusdiasdesouzads/message-locator-js",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.27.2",
    "com.matheusdiasdesouzads.js.language-objects": "^1.1.0"
  }
}
  • Operating system and version: Windows 10 21H2 build 19044.1288
  • If Windows, are you using WSL or WSL2?:
    Windows 10, not WSL.
@TypeStrong TypeStrong locked and limited conversation to collaborators Aug 26, 2022
@cspotcode cspotcode converted this issue into discussion #1873 Aug 26, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant