Dzoukr / SAFEr.Template

Strongly opinionated modification of amazing SAFE Stack Template for full-stack development in F#.
MIT License
107 stars 15 forks source link

Problems with webpack #7

Closed DejanMilicic closed 2 years ago

DejanMilicic commented 2 years ago

With version 2.2.0 I have following problem when running dotnet run

Bundling for development...
Failed to load ./.env.
<i> [webpack-dev-server] [HPM] Proxy created: /api/**  -> http://localhost:5000
<i> [webpack-dev-server] [HPM] Proxy created: /socket/**  -> http://localhost:5000
C:\GitHub\Startup\app\node_modules\webpack\lib\NormalModule.js:207
                        throw new TypeError(
                        ^

TypeError: The 'compilation' argument must be an instance of Compilation
    at Function.getCompilationHooks (C:\GitHub\Startup\app\node_modules\webpack\lib\NormalModule.js:207:10)
    at C:\GitHub\Startup\app\node_modules\webpack\lib\HotModuleReplacementPlugin.js:767:18
    at Hook.eval [as call] (eval at create (C:\GitHub\Startup\App\node_modules\tapable\lib\HookCodeFactory.js:19:10), <anonymous>:102:1)
    at Hook.CALL_DELEGATE [as _call] (C:\GitHub\Startup\App\node_modules\tapable\lib\Hook.js:14:14)
    at C:\GitHub\Startup\App\node_modules\webpack\lib\Compiler.js:1153:29
    at Hook.eval [as callAsync] (eval at create (C:\GitHub\Startup\App\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\GitHub\Startup\App\node_modules\tapable\lib\Hook.js:18:14)
    at Compiler.compile (C:\GitHub\Startup\App\node_modules\webpack\lib\Compiler.js:1148:28)
    at C:\GitHub\Startup\App\node_modules\webpack\lib\Watching.js:214:19
Dzoukr commented 2 years ago

I tried the new version few days ago and no problem there. Maybe something with Node version? 🤷

DejanMilicic commented 2 years ago

Which version of Node are you using?

Dzoukr commented 2 years ago

Cannot look right now - I am on vacation. Will have a look later this week or on Monday. But you can try older versions of template meanwhile. It's strange...

DejanMilicic commented 2 years ago

Sorry for disturbing you on your vacation. I just tried out 2.1.1. and it works without any problems.

DejanMilicic commented 2 years ago

Can you please instruct how to build the project locally?

Dzoukr commented 2 years ago

Looking at last commit (https://github.com/Dzoukr/SAFEr.Template/commit/39f15ee98bd59bc0bbaa200ff19d4469a1360b41) I don't see any difference between last two versions.

You can build it by going into src/default folder and run dotnet run

DejanMilicic commented 2 years ago

I downgraded to 2.1.1, upgraded to 2.2.0 again, and now it works. I suppose standard npm "magic". Thanks for your help!

Before closing this issue, could you help with instructions on how to target different build targets from the command line?

Dzoukr commented 2 years ago

If you mean what I think, it's quite easy dotnet run - run with default target dotnet run MyTarget - run with MyTarget