Skip to content
This repository was archived by the owner on Jul 14, 2026. It is now read-only.
This repository was archived by the owner on Jul 14, 2026. It is now read-only.

Unable to build extension using webpack for latest vortex-api (v2) #60

Description

@madtisa

Description

Building sample extension using latest vortex-api causes error:

> npx webpack

[webpack-cli] Failed to load 'D:\Projects\mods\kp-vortex-extension\webpack.config.js' config
[webpack-cli] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin/webpack' is not defined by "exports" in D:\Projects\mods\kp-vortex-extension\node_modules\vortex-api\package.json
    at exportsNotFound (node:internal/modules/esm/resolve:313:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:660:9)
    at resolveExports (node:internal/modules/cjs/loader:650:36)
    at Function._findPath (node:internal/modules/cjs/loader:717:31)
    at Function._resolveFilename (node:internal/modules/cjs/loader:1369:27)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Function._load (node:internal/modules/cjs/loader:1192:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:237:24) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Show full package.json
{
  "name": "xxx-vortex-extension",
  "version": "1.0.0",
  "scripts": {
    "watch": "npx webpack --watch",
    "build": "npx webpack --progress --profile --color"
  },
  "devDependencies": {
    "@types/fs-extra": "^9.0.4",
    "@types/ini": "^1.3.34",
    "@types/node": "^18.16.16",
    "@types/react": "^16.9.43",
    "@types/react-bootstrap": "^0.32.20",
    "@types/react-i18next": "^8.1.0",
    "@types/react-redux": "^7.1.24",
    "@types/redux": "^3.6.0",
    "@types/redux-thunk": "^2.1.0",
    "@types/string-template": "^1.0.7",
    "copy-webpack-plugin": "^11.0.0",
    "modmeta-db": "Nexus-Mods/modmeta-db",
    "string-template": "^1.0.0",
    "ts-loader": "^9.6.0",
    "typescript": "^5.9.3",
    "vortex-api": "Nexus-Mods/vortex-api",
    "webpack": "^5.107.2",
    "webpack-cli": "^5.1.4"
  },
  "dependencies": {
    "ini": "^4.1.1"
  }
}
Show full webpack.config.js
//@ts-check
const webpack = require('vortex-api/bin/webpack').default;
const CopyWebpackPlugin = require('copy-webpack-plugin');

/**@type {import('webpack').Configuration}*/
const config = webpack('kp-vortex-extension', __dirname, 5);
config.devtool = 'inline-source-map';
config.output.clean = true;
config.plugins.push(new CopyWebpackPlugin({
    patterns: [
        {from: '{images,styles}/*', context: 'src/'},
        {from: 'info.json', context: 'src/'},
    ]
}));

module.exports = config;

I suspect problem is either in typescript v5 or in vortex-api package.json (that lacks export for webpack config)

Workaround

Specified vortex api v1.16.4 in package.json:

"vortex-api": "github:Nexus-Mods/vortex-api#v1.16.4",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions