I have k6 project for run with api call. and i use nodejs so i use webpack for run k6 in project but i have error.
[email protected] start
webpack && node src/index.js
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
configuration.resolve.fallback should be one of these:
[object { alias, name, onlyModule? }, ...] | object { <key>: [non-empty string, ...] | false | non-empty string }
-> Redirect module requests.
Details:
* configuration.resolve.fallback['path'] should be one of these:
[non-empty string, ...] | false | non-empty string
-> New request.
Details:
* configuration.resolve.fallback['path'] should be an array:
[non-empty string, ...]
-> Multiple alternative requests.
* configuration.resolve.fallback['path'] should be false.
-> Ignore request (replace with empty module).
* configuration.resolve.fallback['path'] should be a non-empty string.
-> New request.
This is my webpack for project, I use ES modules to project webpack.config.js
import urlResolve from "url";
import fsResolve from "fs";
import pathResolve from "path-browserify";
export default {
externals: {
k6: "k6",
},
resolve: {
fallback: {
url: urlResolve,
fs: fsResolve,
path: pathResolve
},
},
};
and package.json
{
"name": "k6-api",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "webpack && node src/index.js",
"swagger": "swagger-jsdoc -o swagger.json"
},
"dependencies": {
"express": "^4.18.2",
"k6": "^0.0.0",
"path-browserify": "^1.0.1",
"swagger-jsdoc": "^6.2.8",
"url": "^0.11.3"
},
"type": "module",
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@types/express": "^4.17.21",
"@types/k6": "^0.49.1",
"babel-loader": "^9.1.3",
"core-js": "^3.36.0",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
}
}
And i install npm or webpack , globaly in project