Lombiq / NodeJs-Extensions

Utilities and extensions for Node.js, used in ASP.NET (Core) MVC and Orchard (Core) CMS development.
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Styles and scripts give 404 when deployed unless the default configuration is repeated (OSOE-877) #104

Open Piedone opened 3 months ago

Piedone commented 3 months ago

Supposedly, this is the default config for styles and scripts, so you shouldn't have to add it to your packages.json:

{
...
  "nodejsExtensions": {
    "styles": {
      "source": "Assets/Styles",
      "target": "wwwroot/css"
    },
    "scripts": {
      "source": "Assets/Scripts",
      "target": "wwwroot/js"
    }
  }
}

However, if you omit this, then the files will give a 404 when deployed (to an Azure Web App, if that matters). The files are properly built otherwise though, locally from VS they still work, as well as when built and run with the .NET CLI during UI testing in CI workflows.

Specifying these defaults shouldn't be necessary.

Jira issue

sarahelsaig commented 3 months ago

I'm not sure how to test this, but would deployment work even if you only provide this much?

{
...
  "nodejsExtensions": {
    "styles": { },
    "scripts": { }
  }
}

I'm certain that if the style/script build starts, then the config will correctly get the default values in get-config.js. So I get a sense that maybe the build only triggers if there is a config?

Piedone commented 3 months ago

I've sent you a PM on how you can test it with one of our apps (I can't really test it right now) but perhaps you're on the right track.

sarahelsaig commented 3 months ago

Where? I don't see it.

Piedone commented 3 months ago

I'll give you a hint: it starts with "Teams" and ends with "".

sarahelsaig commented 3 months ago

Yes, obviously that's where I first checked. I haven't gotten a PM in Teams from you in a long while

Piedone commented 3 months ago

Just check the project channel :). Fair enough, not private, just more private than this here.

sarahelsaig commented 3 months ago

Doesn't work, unfortunately. (I get error Invalid group: {}: source must be a string, target must be a string.) The defaults are only filled in if you completely omit the (styles, scripts) property in nodejsExtensions. It still may be because of what I wrote above, but I don't have an easy workaround to test with.

Piedone commented 3 months ago

I see, thank you.