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

'./runtime.js' is not defined by "exports" #622

Closed
Hideman85 opened this issue Apr 3, 2022 · 2 comments
Closed

'./runtime.js' is not defined by "exports" #622

Hideman85 opened this issue Apr 3, 2022 · 2 comments

Comments

@Hideman85
Copy link

Hi, I'm having the following issue:

app_1  | ERROR in ./src/index.tsx
app_1  | Module build failed (from ../../node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js):
app_1  | Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './runtime.js' is not defined by "exports" in /root/app/node_modules/react-refresh/package.json
app_1  |     at new NodeError (internal/errors.js:322:7)
app_1  |     at throwExportsNotFound (internal/modules/esm/resolve.js:332:9)
app_1  |     at packageExportsResolve (internal/modules/esm/resolve.js:565:3)
app_1  |     at resolveExports (internal/modules/cjs/loader.js:450:36)
app_1  |     at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
app_1  |     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
app_1  |     at Function.resolve (internal/modules/cjs/helpers.js:107:19)
app_1  |     at Object.<anonymous> (/root/app/node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js:20:4)
app_1  |     at Module._compile (internal/modules/cjs/loader.js:1085:14)
app_1  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
app_1  | 
app_1  | ERROR in ../../node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js 4:23-58
app_1  | Module not found: Error: Package path ./runtime.js is not exported from package /root/app/node_modules/react-refresh (see exports field in /root/app/node_modules/react-refresh/package.json)

This is really weird because the package.json looks for me perfect:

  "files": [
    "LICENSE",
    "README.md",
    "babel.js",
    "runtime.js",
    "cjs/",
    "umd/"
  ],
  "main": "runtime.js",
  "exports": {
    ".": "./runtime.js",
    "./runtime.js": "./runtime.js", // Note adding this one works :thinking: does it make any sense? 
    "./runtime": "./runtime.js",
    "./babel": "./babel.js",
    "./package.json": "./package.json"
  },

Using Ubuntu 21.10 with these lib versions:

    "@pmmmwh/react-refresh-webpack-plugin": "~0.5.4",
    "@babel/core": "~7.17.8",
    "babel-loader": "~8.2.4",
    "webpack": "~5.71.0",
    "webpack-dev-server": "~4.7.4"

Any idea?

@max-mykhailenko
Copy link

max-mykhailenko commented Apr 3, 2022

I have the same problem with React 18. Issue can be related to #621

@pmmmwh pmmmwh closed this as completed Apr 4, 2022
@pmmmwh
Copy link
Owner

pmmmwh commented Apr 4, 2022

Already fixed in master.

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

3 participants