onflow / cadence

Cadence, the resource-oriented smart contract programming language 🏃‍♂️
https://cadence-lang.org
Apache License 2.0
534 stars 138 forks source link

@onflow/cadence-parser Cannot use import statement outside a module #1873

Closed LemonNekoGH closed 1 month ago

LemonNekoGH commented 2 years ago

Problem

I can't use @onflow/cadence-parser to parse my Cadence code, because Cannot use import statement outside a module error.

Steps to Reproduce

  1. pnpm i @onflow/cadence-parser
  2. write code below
    import {CadenceParser} from "@onflow/cadence-parser"
    const parser = await CadenceParser.create("cadence-parser.wasm")
  3. run your project
  4. see the error

    /Users/lemonneko/transform/node_modules/@onflow/cadence-parser/dist/index.js:27
    import { go } from './go.js';
    ^^^^^^
    
    SyntaxError: Cannot use import statement outside a module
gregsantos commented 2 years ago

Hi @LemonNekoGH Mind providing a bit more context here, specifically on 3. Run your project. Are you running this with node, if so what version?

LemonNekoGH commented 2 years ago

sorry, i run program using node 16 with pnpm and next

LemonNekoGH commented 2 years ago

i tryed to build package from your latest code, errors disappeared. the latest code seems sloved this promblem.

LemonNekoGH commented 2 years ago

image this package with version 0.20.2 is published 9 mounth ago and latest tag is 0.25.0

turbolent commented 1 month ago

This should be fixed now. Please open a new issue if there is still a problem