can't require `@prefresh/babel-plugin`
See original GitHub issueI ran into this using next-plugin-preact
but I believe it’s an issue with @prefresh/babel-plugin
.
I created a Next app using Preact:
❯ npx create-next-app --example using-preact next-preact-npm
And npm run dev
gave me this error:
Error: Cannot find module '/Users/eostrom/workspace/swagleft/next-preact-npm/node_modules/@prefresh/babel-plugin/dist/src/index.js'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:960:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:953:15)
at resolveExports (node:internal/modules/cjs/loader:482:14)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.mod._resolveFilename (/Users/eostrom/workspace/swagleft/next-preact-npm/node_modules/next/dist/build/webpack/require-hook.js:183:28)
at Function.Module._resolveFilename (/Users/eostrom/workspace/swagleft/next-preact-npm/node_modules/module-alias/index.js:49:29)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at Object.webpack (/Users/eostrom/workspace/swagleft/next-preact-npm/node_modules/@prefresh/next/src/index.js:29:19)
at Object.getBaseWebpackConfig [as default] (/Users/eostrom/workspace/swagleft/next-preact-npm/node_modules/next/dist/build/webpack-config.js:1411:32) {
code: 'MODULE_NOT_FOUND',
path: '/Users/eostrom/workspace/swagleft/next-preact-npm/node_modules/@prefresh/babel-plugin/package.json'
I don’t have a deep understanding of npm, but I think the problem is in packages/babel/package.json
:
"exports": {
".": {
"import": "./src/index.mjs",
"require": "./dist/src/index.js"
},
"./package.json": "./package.json"
},
The require
line references a file that doesn’t seem to have been installed with the package.
I have a non-Next minimal test case, which I’ll upload shortly.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
react-refresh-webpack-plugin/TROUBLESHOOTING.md at main
A Webpack plugin to enable "Fast Refresh" (also previously known as Hot Reloading) for React components. - react-refresh-webpack-plugin/TROUBLESHOOTING.md ...
Read more >Webpack5 + react-refresh-webpack-plugin does not work
I have been trying to setup fast refreshing and hot reloading in react with `webpack5 following the documentation for react-refresh-webpack- ...
Read more >babel-loader - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Plugins - Babel.js
In rarer cases (if the transform isn't implemented yet, or there isn't a default way to do so), you can use plugins such...
Read more >babel/preset-react
Automatic runtime (since v7.9.0 ) adds the functionality for these plugins automatically when the development option is enabled. If you have automatic runtime ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
They should have received a bump normally https://github.com/preactjs/prefresh/commit/ce94464156d6375f7d6634514dbc7a72fc033900
Published a fix in 0.4.3 - thanks for the report ❤️