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

Breaking with next.js 13 app folder #183

Closed
gaetleba opened this issue Nov 7, 2022 · 5 comments
Closed

Breaking with next.js 13 app folder #183

gaetleba opened this issue Nov 7, 2022 · 5 comments

Comments

@gaetleba
Copy link

gaetleba commented Nov 7, 2022

Hi, I'm not sure if this is a problem with the plugin or Next but here is a bug I'm encountering :
Trying to use this plugin with a Next.js project and the latest next feature app folder I get the following bug:

error - (sc_server)\node_modules\next\dist\shared\lib\app-router-context.js (10:40) @ eval
error - TypeError: _react.default.createContext is not a function
    at eval (webpack-internal:///(sc_server)/./node_modules/next/dist/shared/lib/app-router-context.js:297:77)
    at Object.(sc_server)/./node_modules/next/dist/shared/lib/app-router-context.js (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\app\page.js:920:1)
    at __webpack_require__ (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///(sc_server)/./node_modules/next/dist/client/components/app-router.js:2314:61)
    at Object.(sc_server)/./node_modules/next/dist/client/components/app-router.js (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\app\page.js:197:1)
    at __webpack_require__ (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\webpack-runtime.js:33:42)
    at eval (webpack-internal:///(sc_server)/./node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fpage&appPaths=%2Fpage&pagePath=private-next-app-dir%2Fpage.tsx&appDir=C%3A%5CUsers%5CWarrows%5Cworkspace%5Crepronext%5Cswc-coverage%5Capp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=C%3A%5CUsers%5CWarrows%5Cworkspace%5Crepronext%5Cswc-coverage&isDev=true&tsconfigPath=tsconfig.json!:28:24)
    at Object.(sc_server)/./node_modules/next/dist/build/webpack/loaders/next-app-loader.js?name=app%2Fpage&appPaths=%2Fpage&pagePath=private-next-app-dir%2Fpage.tsx&appDir=C%3A%5CUsers%5CWarrows%5Cworkspace%5Crepronext%5Cswc-coverage%5Capp&pageExtensions=tsx&pageExtensions=ts&pageExtensions=jsx&pageExtensions=js&rootDir=C%3A%5CUsers%5CWarrows%5Cworkspace%5Crepronext%5Cswc-coverage&isDev=true&tsconfigPath=tsconfig.json! (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\app\page.js:99:1)
    at __webpack_require__ (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\webpack-runtime.js:33:42)
    at __webpack_exec__ (C:\Users\Warrows\workspace\repronext\swc-coverage\.next\server\app\page.js:974:39) {
  page: '/'
}
null

Using the same project with babel and babel-plugin-istanbul works fine.
Here is a reproduction project : https://github.com/gaetleba/swc-plugin-coverage-instrument-bug-reproduction
I made a report over there too: vercel/next.js#42580

@kwonoj
Copy link
Owner

kwonoj commented Nov 7, 2022

Looks like plugin affects something, probably not a bug in next.js upstream.

@kwonoj
Copy link
Owner

kwonoj commented Nov 13, 2022

Looks like there's common symptom when custom transform / plugin is enabled: vercel/next.js#41994

@divramod
Copy link

divramod commented Feb 2, 2023

@gaetleba where you somehow able to fix this issue with the experimental app feature?

@gaetleba
Copy link
Author

gaetleba commented Feb 3, 2023

@gaetleba where you somehow able to fix this issue with the experimental app feature?

No, I'm using babel for now

@kwonoj
Copy link
Owner

kwonoj commented Apr 25, 2023

I've been peeking this bit, this is mostly due to server component side transform error. I can't explain why it occurs with this specific plugin, as well as cannot change plugin's behavior to amend it (since I don't have explanation why server component is being affected).

I'm going to close this for now. If anyone have minimal reproduction which doesn't have server component involved and transforming with this plugin creates offending codes, I may able to look into.

@kwonoj kwonoj closed this as completed Apr 25, 2023
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