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

v3 Breaks Typescript Build #193

Open
LoganArnett opened this issue May 19, 2022 · 7 comments
Open

v3 Breaks Typescript Build #193

LoganArnett opened this issue May 19, 2022 · 7 comments

Comments

@LoganArnett
Copy link

LoganArnett commented May 19, 2022

I am not entirely sure what the issue is but on v2.6.0 everything works so I reverted back to that version but when I attempted to build the same project o v3.0.0 with a node version of v16+ the build succeeds with no errors but when the code is run I get this error:

"require() of ES Module /var/task/node_modules/retry-axios/build/src/index.js from /var/task/utils/axios.js not supported.\nInstead change the require of index.js in /var/task/utils/axios.js to a dynamic import() which is available in all CommonJS modules."

I attempted to change the import structure between both

import rax from 'retry-axios';

// and

import * as rax from 'retry-axios';

And still got the same error.

Just curious if there is something obvious I need to do to be able to upgrade to v3.

@zymotik
Copy link

zymotik commented May 30, 2022

I have an error that I believe is related when using the Vue 2.6 build tools. I see a message in the console "This dependency was not found" with the suggestion "To install it, you can run: npm install --save retry-axios"

Code:

import * as rax from "retry-axios";

Results in:

 ERROR  Failed to compile with 1 error

This dependency was not found:

* retry-axios in ./src/backend/tracking/tracking-client.ts

To install it, you can run: npm install --save retry-axios

My package.json has retry-axios in it, this is a cleaned up version for brevity:

{
  "name": "ui",
  "version": "1.0.0-0",
  "scripts": {
    "serve": "vue-cli-service serve --port 8082",
    "build": "vue-cli-service build"
  },
  "dependencies": {
    "axios": "0.26.0",
    "retry-axios": "^3.0.0",
    "vue": "2.6.14",
    "vue-router": "3.5.2",
    "vuetify": "2.5.6",
    "vuex": "3.6.2"
  },
  "devDependencies": {
    "@typescript-eslint/parser": "5.10.1",
    "@vue/cli-plugin-babel": "4.5.15",
    "@vue/cli-plugin-eslint": "5.0.4",
    "@vue/cli-plugin-router": "4.5.15",
    "@vue/cli-plugin-typescript": "4.5.13",
    "@vue/cli-plugin-unit-jest": "4.5.13",
    "@vue/cli-plugin-vuex": "5.0.4",
    "@vue/cli-service": "4.5.13",
    "ts-jest": "^26.5.6",
    "typescript": "4.3.4"
  }
}

Versions:
Node: 16.14.0
TypeScript version 4.3.4
retry-axios 3.0.0
VueJs 2.6.14
@vue/cli-service 4.5.13

@ashkanjj
Copy link

I'm getting the same, happy to create a reproducible setup in somewhere like codesandbox if anyone is happy to look into this?

@leefsmp
Copy link

leefsmp commented Jul 15, 2022

Same here, getting error ERR_REQUIRE_ESM which seems to be related to the way lib is being exported:
standard-things/esm#868
Reverting to 2.6.0 works thanks.

@leopucci
Copy link

image

@DavidHe1127
Copy link

DavidHe1127 commented Aug 5, 2022

We see a different error

    Details:

    /work/node_modules/retry-axios/build/src/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import axios from 'axios';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      3 | import * as k8s from '@kubernetes/client-node';
      4 | import axios, { AxiosError } from 'axios';
    > 5 | import * as rax from 'retry-axios';
        | ^
      6 | import * as https from 'https';
      7 |
      8 | // The `waitForStatefulset` checks are necessary because Pulumi does not

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (src/tests/system/prometheus.spec.ts:5:1)

Adding config below to transform that file doesn't work

  "transformIgnorePatterns": [
    "node_modules/(?!retry-axios/build/src/index)"
  ]

Removed rax.attach(); didn't cause the error though.

@hisham
Copy link

hisham commented Jan 25, 2024

+1

1 similar comment
@willbui256resi
Copy link

+1

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

8 participants