This repository was archived by the owner on Feb 12, 2021. It is now read-only.
removed html-loader #1
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Denna PR löser ett problem med webpackkonfigurationen som jag stötte på.
Den här kursen kommer visserligen att avslutas men jag antar att ni kommer att ha samma problem i andra projekt så det kanske kan vara till nytta ändå :)
Så här kan problemet reproduceras:
npm installwindow.alert('test'). Avsluta med radbrytning.npm start.Förväntat utfall:
koden kompilerar, och javascriptet fungerar när du surfar till localhost med en webbläsare.
Faktiskt utfall:
Koden kompilerar inte. Webpack klagar på att window (eller document om du använde det i ditt javascript) inte är definierat.
Det verkar som att felet har med Webpack 4 eller html-loader 2.* att göra. Så jag antar att det fungerade när repot skapades, men eftersom inga exakta versioner av Webpack eller html-loader specificeras i package.json fungerar det inte längre nu när man installerar och får de senaste versionerna.
Denna PR tar bort html-loader och då fungerar allt. Nackdelen är att html-filen inte blir minifierad i produktionsläge, men det lär väl inte ha så stor betydelse.