cli icon indicating copy to clipboard operation
cli copied to clipboard

NetCore Webpack generates broken links in Prod builds

Open anwnqvis opened this issue 7 years ago • 4 comments

I'm submitting a bug report

  • Library Version: 0.33.1

Please tell us about your environment:

  • Operating System: Windows 10

  • Node Version: 8.10.0

  • NPM Version: 6.1.0

  • Browser: all?

  • Language: TypeScript 2.8.1

  • Loader/bundler: Webpack

Current behavior: Files loaded with file-loader get no prefix in path but they are put in 'dist'. This makes IIS look for them under the 'wwwroot' folder instead of 'wwwroot/dist'.

  • What is the expected behavior? Files should have baseUrl 'dist/' instead of '/'.

anwnqvis avatar Jul 09 '18 06:07 anwnqvis

Hey @anwnqvis 👋

is this when using javascriptservices or not?

JeroenVinke avatar Jul 19 '18 10:07 JeroenVinke

Using aurelia-cli v1.2.3, I was able to resolve this issue by changing the production build script in package.json to:

"build": "webpack --env.production --extractCss --config webpack.netcore.config.js"

Could/should the aurelia-cli be updated to use the .net core specific config file when generating a new .net core project?

alexisszabo avatar Feb 20 '20 22:02 alexisszabo

I don't use .net, but this sounds right. @Sayan751 ☝️ could you help to review the above proposal?

3cp avatar Feb 20 '20 23:02 3cp

@3cp Frankly, I have looked into the generated skeleton for netcore for the first time today :) There are couple of things I find to be confusing.

  • The usage of a a second config file for netcore. why not generate just the correct one for netcore in the first go. Also I see that var originalConfig = webpackConfig({}); is not passing any arguments from cli to the webpack config, as it is the case normally.
  • It seems that the usage of Microsoft.AspNetCore.SpaServices.Webpack is now deprecated. So we need to upgrade the netcore skeleton anyway.

I think it is better to take a closer look at the generated skeleton, and do some cleanup as well as the necessary upgarde.

Sayan751 avatar Feb 21 '20 20:02 Sayan751