flareact / flareact

Edge-rendered React framework built for Cloudflare Workers
https://flareact.com
MIT License
1.81k stars 77 forks source link

Webpack error on flareact dev #25

Open insuusvenerati opened 4 years ago

insuusvenerati commented 4 years ago

Running into this error when running webpack dev.

$ flareact dev
Starting Flareact dev server...
[worker]  (webpack)/buildin/global.js
[worker] Module not found: Error: Can't resolve '@babel/runtime/helpers/typeof' in 'C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\buildin'
[worker] resolve '@babel/runtime/helpers/typeof' in 'C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\buildin'
[worker]   Parsed request is a module
[worker]   using description file: C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\package.json (relative path: ./buildin)
[worker]     Field 'browser' doesn't contain a valid alias configuration
[worker]     resolve as module
[worker]       C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\buildin\node_modules doesn't exist or is not a directory
[worker]       C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\node_modules doesn't exist or is not a directory
[worker]       C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\node_modules doesn't exist or is not a directory
[worker]       C:\Users\norwo\AppData\Local\.wrangler\node_modules doesn't exist or is not a directory
[worker]       C:\Users\norwo\AppData\Local\node_modules doesn't exist or is not a directory
[worker]       C:\Users\norwo\AppData\node_modules doesn't exist or is not a directory
[worker]       C:\Users\norwo\node_modules doesn't exist or is not a directory
[worker]       C:\Users\node_modules doesn't exist or is not a directory
[worker]       C:\node_modules doesn't exist or is not a directory
[worker]       looking for modules in C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules
[worker]         using description file: C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\package.json (relative path: ./node_modules)
[worker]           Field 'browser' doesn't contain a valid alias configuration
[worker]           using description file: C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\package.json (relative path: ./node_modules/@babel/runtime/helpers/typeof)
[worker]             no extension
[worker]               Field 'browser' doesn't contain a valid alias configuration
[worker]               C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof doesn't exist
[worker]             .wasm
[worker]               Field 'browser' doesn't contain a valid alias configuration
[worker]               C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.wasm doesn't exist
[worker]             .mjs
[worker]               Field 'browser' doesn't contain a valid alias configuration
[worker]               C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.mjs doesn't exist
[worker]             .js
[worker]               Field 'browser' doesn't contain a valid alias configuration
[worker]               C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.js doesn't exist
[worker]             .json
[worker]               Field 'browser' doesn't contain a valid alias configuration
[worker]               C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.json doesn't exist
[worker]             as directory
[worker]               C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof doesn't exist
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\buildin\node_modules]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\webpack\node_modules]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\node_modules]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\node_modules]
[worker] [C:\Users\norwo\AppData\Local\node_modules]
[worker] [C:\Users\norwo\AppData\node_modules]
[worker] [C:\Users\norwo\node_modules]
[worker] [C:\Users\node_modules]
[worker] [C:\node_modules]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.wasm]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.mjs]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.js]
[worker] [C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\node_modules\@babel\runtime\helpers\typeof.json]
[worker]  @ (webpack)/buildin/global.js 1:0-52 13:53-60
[worker]  @ D:/Code/JS/flareact-fork/node_modules/react-helmet/es/Helmet.js
[worker]  @ D:/Code/JS/flareact-fork/src/worker/index.js
[worker]  @ D:/Code/JS/flareact-fork/src/worker/worker.js
[worker]  @ D:/Code/JS/flareact-fork/src/index.js
[worker]  @ ./index.js
[worker] Error: webpack returned an error. Try configuring `entry` in your webpack config relative to the current working directory, or setting `context = __dirname` in your webpack config.
[worker] wrangler dev exited with code 1
--> Sending SIGTERM to other processes..
[client] webpack-dev-server --config node_modules/flareact/configs/webpack.client.config.js --mode development exited with code 1
[ 1, 1 ]
Done in 10.38s.

I don't understand the underlying cause of the issue but it was resolved by installing @bable/runtime directly into the wrangler packages location on my machine.

jplhomer commented 4 years ago

Hmm very mysterious. To be honest, I haven't tested this at all on Windows, so your guess is as good as mine. I'll think about this and see if I come up with anything.

d2x commented 3 years ago

I don't understand the underlying cause of the issue but it was resolved by installing @bable/runtime directly into the wrangler packages location on my machine.

@insuusvenerati can you please elaborate on how you solved it?

I have wrangler installed globally (~/AppData/Roaming/npm/node_modules/@cloudflare/wrangler)

Installed @bable/runtime globally as well, didn't work. Installed @bable/runtime into ~/AppData/Roaming/npm/node_modules/@cloudflare/wrangler, also didn't work.

william1616 commented 3 years ago

@d2x it seams to work if you run npm i @babel/runtime in path in the error log - in this case C:\Users\norwo\AppData\Local\.wrangler\wranglerjs-1.11.0\

adnan1naeem commented 2 years ago

@jplhomer I am facing same issue on windows but on mac it works fine.Installing directly in the directory also doesn't work

tj-kev commented 2 years ago

Have you tried running under WSL?