Open nenadvicentic opened 5 years ago
So there is only instruction on how to hook up webpack. That's probably why old cli didn't have cli-bundler option for dotnet-core app.
I am not a dotnet user, I cannot even got a sample dotnet 2.2 app with aurelia+webpack working, dotnet run
still renders old dotnet page, not aurelia app page.
@brandonseydel @artmasa @arjendeblok do you guys knows how to hook up cli-bundler front-end in the Startup.cs
? If it's too troublesome, we have to turn off cli-bundler for dotnet-core skeleton.
https://github.com/aurelia/dotnet/blob/master/README.md
You can download the night package and follow the readme to patch an existing cli project. You can also download the templates and start from there.
@3cp I think combination of cli-bundler and dotnet-core project is valid to have, even without tight development integration and hot-module-replacement in place. I am actually using it like this for years.
Bigger problem is that so many project template combinations in aurelia-cli
are not setup correctly and do not work from get-go, so new users have no clue what to do.
@brandonseydel I'll take a look at those templates. Thx.
@nenadvicentic if you know how to hook them up, please send a PR :-)
@3cp I did not manage to connect aurelia-cli
with dev middleware myself, but project templates for .NET Core which @brandonseydel suggested above have implementation that works. It uses middleware from aurelia/dotnet:
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseSpa(spa => {
spa.Options.SourcePath = "%replaceWithAureliaCLIRoot%";
if (env.IsDevelopment())
{
spa.UseAureliaCliServer(); // Optional HMR (Hot Module Reload)
}
});
Oh, I didn't know @brandonseydel's solution works for cli-bundler too. We probably should use the middleware in default cli template offering, if someone can create a PR.
I'm submitting a bug report
Please tell us about your environment:
Operating System: Windows 10
Browser: all
Language: TypeScript 3.4.5
Loader/bundler: RequireJS/Aurelia build-in bundler
Current behavior:
Startup.cs
class contains code for Webpack Dev Middleware, which should not be used with Aurelia built-in bundler.Bellow are full project options selected:
Global aurelia-cli v1.0.0
| () _ / | | | | / ` | | | | '/ \ | |/ ` | | | | | | | | (| | || | | | / | | (| | | || | | | _,|_,|| _|||_,| __|___|___|
√ Please enter a name for your new project: · WebApplication-Aureli-Cli √ Would you like to use the default setup or customize your choices? · Custom App √ Which bundler would you like to use? · CLI's built-in bundler with an AMD module loader √ Which AMD module loader would you like to use? · RequireJS √ What platform are you targeting? · .NET Core √ What transpiler would you like to use? · TypeScript √ How would you like to setup your HTML template? · Minimum Minification √ What css preprocessor would you like to use? · Sass √ Do you want to add PostCSS processing · Typical √ Which unit test runner would you like to use? · Jest √ Would you like to configure integration testing? · Protractor √ What is your default code editor? · Visual Studio Code √ Which features do you want scaffolded into your project? · Navigation App
Error is: ---> (Inner Exception #0) Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object. (C:\Users\Nenad\AppData\Local\Temp\pd2rae2s.bpj:83:19)
at __webpack_require__ (C:\Users\Nenad\AppData\Local\Temp\pd2rae2s.bpj:20:30)
at createWebpackDevServer (C:\Users\Nenad\AppData\Local\Temp\pd2rae2s.bpj:62:26)
at C:\Users\Nenad\AppData\Local\Temp\1vtizutj.5vx:114:19
at IncomingMessage. (C:\Users\Nenad\AppData\Local\Temp\1vtizutj.5vx:133:38)
at IncomingMessage.emit (events.js:194:15)
Current directory is: c:\Users\Nenad\source\repos\WebApplication-Aureli-Cli