http-vue-loader icon indicating copy to clipboard operation
http-vue-loader copied to clipboard

If working in Visual Studio 2017

Open BuhoSabio opened this issue 6 years ago • 9 comments
trafficstars

Just to mention, that will need to set mimeType for ".vue" extension file to use httpvueloader

May need to do it in Project "ApplicationHost" config file or in IIS Express "ApplicationHost" config file.

Project: C:\Users<your name>\Documents\Visual Studio 2017\Projects<project name>.vs\config

IIS Express: C:\Users<your name>\Documents\IISExpress\config

<mimeMap fileExtension=".vue" mimeType="application/javascript" />

Otherwise, keeps throwing file not found when referencing url file .vue.

BuhoSabio avatar Dec 04 '18 20:12 BuhoSabio

Yeah, this is a common thing to who use visual studio projects...

giolvani avatar Dec 05 '18 14:12 giolvani

Thanks for the tip. But Chrome often handles Vue files as static resources, so how do I configure config to get the latest modified Vue files correctly every time? I'm using asp.net.

youxiaotian avatar Feb 27 '19 10:02 youxiaotian

All right. I found a way. image

youxiaotian avatar Feb 27 '19 11:02 youxiaotian

@Yxjhasadream you should use cache-busting on querystring parameters instead of using this option from chrome.

giolvani avatar Feb 28 '19 00:02 giolvani

@giolvani It really should be, thank you. But I usually need chrome not to cache when I'm debugging, and it's better to cache when it's released.

youxiaotian avatar Mar 05 '19 09:03 youxiaotian

In MVC Core projects you can use something like this in your Startup.cs Configure:

app.UseStaticFiles(new StaticFileOptions
{
    ContentTypeProvider = new FileExtensionContentTypeProvider(
        new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) {
            { ".vue", "application/javascript" }
        }),
});

I feel that's more maintainable than in the ApplicationHost.

BinarySpike avatar Mar 14 '19 23:03 BinarySpike

I know this is an old issue, but another way to set this up in an ASP.NET app, is to add the following to the web.config:

  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".vue" mimeType="application/javascript"/>
    </staticContent>
  </system.webServer>

richsoft avatar Nov 26 '19 14:11 richsoft

For some reason the dev server to use in VueJS in a basic VueJS project (started with npm run serve which runs vue-cli-service serve) .vue files are served as XML. In this case the loader errors out with "responseText is undefined" - i checked networking activities and the result seems to be fine, so i think, this is also mime-type related. Can someone confirm this? And, can someone provide a fix for this?

SeaLife avatar Dec 11 '19 09:12 SeaLife

Failed to resolve async component default: ReferenceError: responseText is not defined

running wamp server on windows

looking deeper, the error is this:

SyntaxError: "export declarations may only appear at top level of a module"

gaby64 avatar Dec 17 '19 20:12 gaby64