Hello, I am trying to transpile K6 script into ES5. Yet, it is not working. I try to transpile following code based on the project from template-es6 repository: https://github.com/k6io/template-es6
Transpiled code should work with --compatibility-mode=base flag
When I run k6 run --compatibility-mode=base XXX.js, it gives me following error:
ERRO[0000] GoError: https://jslib.k6.io/url/1.0.0/index.js: Line 2:115 Unexpected token ) (and 186 more errors) at reflect.methodValueCall (native)
// Creator: WebInspector 537.36
import { sleep, check, group } from "k6";
import http from "k6/http";
import { URL } from "https://jslib.k6.io/url/1.0.0/index.js";
import jsonpath from "https://jslib.k6.io/jsonpath/1.0.2/index.js";
export const options = {
"maxRedirects": 0,
"throw": true,
"setupTimeout": "60s",
"teardownTimeout": "60s",
"batch": 1,
"insecureSkipTLSVerify": true
}
export default function main() {
let address, response;
const vars = {};
group('hello', function () { })
// Automatically added sleep
sleep(1);
}
3.After transpile the code, run it with --compatibility-mode=base flag.
Hi @3wweiweiwu,
It seems that webpack(which is what is used in combination with babel to make template-es6 work) does not have the ability to donwload remote imports(once that are imported by https url instead of by a file path). Using https://github.com/roneyrao/remote-webpack-plugin should work, but I haven't tried it and doesn't seem to be in development anymore so :man_shrugging: .
The easiest way to fix this will be to download the 2 scripts that you are importing remotely and import them locally :).
Hope this helps.
This issue has been moved to https://github.com/k6io/template-es6/issues/1. Closing this one.
Most helpful comment
This issue has been moved to https://github.com/k6io/template-es6/issues/1. Closing this one.