Giter Site home page Giter Site logo

webpack.net's People

Contributors

martynsmall avatar ronaldbarendse avatar stevegreatrex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

webpack.net's Issues

Reload on manifest change

Loading the manifest file is already done lazily, but when the file changes, not reloaded. The website must now be restarted to pick up the changes.

Adding a ReloadOnChange boolean property to the WebpackConfig class with a default value of false would keep it backwards compatible and an opt-in feature per manifest (and in line with ASP.NET Core conventions for configuration files).

The reloading could be done by using a FileSystemWatcher and subscribing to the Changed event.

css caching

Is there any plan to support load and injection of css chunked file names;

Compatibility with react-create-app

Hi, I'm trying to use this library with create-react-app, without ejecting the project.
The issue with this is that I cannot modify webpack.config (in fact I don't even have one in my app folder), and it uses webpack-manifest-plugin instead of assets-webpack-plugin, which produces an asset mapping file with a different structure.
I'm forking the project since I need to have it working fast with my use case - and BTW, thanks for this, there are plenty of webpack/react integrations with .NET Core, pretty much none for .NET 4.x - but if you're interested we could think of a configurable definition for the asset json.

AssetUrl call crashes with Server operation is not available in this context.

  1. The issue is related to Sitecore 9 application. App is hosted locally on IIS 10 with integrated v4.0 application pool. I did check with standard ASP.NET MVC app and it should work fine (details in 4.; similar deployment settings).
  2. Webpack configuration is done via sitecore's initialize pipeline. This is a substitute for Application_Start and works fine with all initializations that I have. Configuration code:
private void RegisterWebpack()
{
	var applicationInstance = HttpContext.Current.ApplicationInstance;
	applicationInstance.ConfigureWebpack(new WebpackConfig
	{
		AssetManifestPath = "~/webpack-assets.json",
		AssetOutputPath = "~/",
	});
}
  1. Build succeeds, but when trying to enter website, application crashes with exception
[HttpException (0x80004005): Server operation is not available in this context.]
   System.Web.HttpServerUtility.MapPath(String path) +225
   Webpack.NET.Webpack.GetAssetDictionaryForConfig(WebpackConfig configuration, HttpServerUtilityBase httpServerUtility) +26
   System.Linq.WhereSelectArrayIterator`2.MoveNext() +78
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +436
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +70
   System.Lazy`1.CreateValue() +708
   System.Lazy`1.LazyInitValue() +184
   Webpack.NET.Webpack.GetAssetUrl(String assetName, String assetType, Boolean required) +101
   Webpack.NET.UrlHelperExtensions.WebpackAsset(UrlHelper urlHelper, String assetName, String assetType, Boolean required) +87
   ASP._Page_Views_Shared__Default_cshtml.Execute() in [full local path here]\Views\Shared\_Default.cshtml:17
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +136
   Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +257
  1. I did some digging and found out that applicationInstance used in registration has Server property with null assigned to _context. This propagates into HttpServerUtility.MapPath and crashes as this method requires _context field to exist. In standard ASP.NET MVC app this _context is filled at Application_Start.
  2. When I move the code from initialize pipeline's handler directly to _Default.cshtml then everything works fine, because at this point HttpContext.Current.ApplicationInstance.Server contains _context with proper object assigned.
  3. I found out a suggestion (here) to use System.Web.Hosting.HostingEnvironment.MapPath method instead of HttpServerUtility.MapPath, because it does not require HttpContext and under the hood HttpServerUtility.MapPath reaches to suggested method.

UrlHelper not registering

I got everything setup in Global.asax but in the .cshtml file, the error occurs

'UrlHelper' does not contain a definition for 'WebpackAsset' and no extension method 'WebpackAsset' accepting a first argument of type 'UrlHelper' could be found (are you missing a using directive or an assembly reference?)

Any idea why the extension isn't registering?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.