Skip to content
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

Error when building for Angular 5 #141

Closed
dallascaley opened this issue Apr 12, 2018 · 6 comments
Closed

Error when building for Angular 5 #141

dallascaley opened this issue Apr 12, 2018 · 6 comments

Comments

@dallascaley
Copy link

dallascaley commented Apr 12, 2018

I have imported remote-pay-cloud 1.4.3 into my application and i get the following error when i do an ng build --prod:

ERROR in node_modules/remote-pay-cloud/src/com/clover/remote/client/transport/websocket/WebSocketCloudCloverTransport.ts(1,1): error TS1202: Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.

I fixed the error in my local environment by simply removing the first import from the WebSocketCloudCloverTransport.ts file which looks like this:

import http = require('http');

I also verified that for my current functionality needs the package still works without that import but I almost guarantee that i broke something else somewhere by removing it. I would appreciate if someone could look at what I did here and fix the problem correctly.

@david-clover-com
Copy link
Contributor

david-clover-com commented Apr 12, 2018

Thanks @dallascaley, this looks like it may be an old/un-needed import, either way require isn't compatible with es6 which I assume is what module is set to in your tsconfig?

@dallascaley
Copy link
Author

It appears as though es5 is what is set in our tsconfig, however I don't know if I fully understand how the tsconfig works even. I see one tsconfig.json file at the root of the project with the following:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": ".",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

I see another which resides in our src folder with this: (called tsconfig.app.json)

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": ".",
    "paths": {
      "@services/*": ["./app/services/*"]
    },
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

and yet another also in src with this: (called tsconfig.spec.json)

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/spec",
    "baseUrl": ".",
    "module": "commonjs",
    "target": "es5",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ]
}

I have no clue which is actually being used or what precedence they are in. None seem to imply es6 however

@dallascaley
Copy link
Author

Any plans on fixing this? My release manager is a bit annoyed that he had to write a script to fix this after each build.

@david-clover-com
Copy link
Contributor

david-clover-com commented May 3, 2018

@dallascaley, we have fixed this in our development repository and it will be published in the next release. I do not have a date on that as of yet.

@dallascaley
Copy link
Author

awesome, thanks.

david-clover-com added a commit that referenced this issue Sep 12, 2018
Test was passing when HTTP status != 200 was returned
@david-clover-com
Copy link
Contributor

This has been fixed in the 3.0.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants