grantila / typeconv

Convert between JSON Schema, TypeScript, GraphQL, Open API and SureType
MIT License
421 stars 8 forks source link

ParseError: 'import' and 'export' may appear only with 'sourceType: module' #45

Open lastlink opened 3 months ago

lastlink commented 3 months ago

I'm getting a build error when trying to import any of the libraries

node_modules\typeconv\dist\index.js:1
export * from "./types.js";
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

main.ts

import {
    getTypeScriptReader,
    getOpenApiWriter,
    makeConverter,
    getTypeScriptWriter,
    getOpenApiReader,
  } from "typeconv"

tsconfig.json

 "target": "es2016",                                  /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    "lib": [
      "DOM",
      "ES2016"
    ], 
   "module": "CommonJS",                                /* Specify what module code is generated. */

package.json

    "build:client": "npm run mkdir:dist && browserify src/main.ts -p [ tsify --noImplicitAny ] > dist/bundle.js",

npm run build;client