-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby): Update mini-css-extract-plugin to fix inc builds issue (#…
…33979) * remove obsolete option * update plugin * update netlify * clarify comment * update e2e test * types * remove resolutions * update css-loader * tests(artifacts): add css import to test site (#33982) * things work now? * wip * clean * asset tests * wrap with offline plugin * add back url loader Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: gatsbybot <[email protected]>
- Loading branch information
1 parent
9bd1e01
commit 725dc36
Showing
17 changed files
with
140 additions
and
82 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
e2e-tests/production-runtime/cypress/integration/assets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
describe(`webpack assets`, () => { | ||
beforeEach(() => { | ||
cy.intercept("/gatsby-astronaut.png").as("static-folder-image") | ||
// Should load two files: normal and italic | ||
cy.intercept("/static/merriweather-latin-300**.woff2").as("font") | ||
cy.intercept("/static/gatsby-astronaut-**.png").as("img-import") | ||
cy.visit(`/assets/`).waitForRouteChange() | ||
}) | ||
|
||
// Service worker is handling requests so this one is cached by previous runs | ||
if (!Cypress.env(`TEST_PLUGIN_OFFLINE`)) { | ||
it(`should only create one font file (no duplicates with different hashes)`, () => { | ||
// Check that there is no duplicate files (should have italic as second request, not another normal font) | ||
cy.wait("@font").should(req => { | ||
expect(req.response.url).to.match(/merriweather-latin-300-/i) | ||
}) | ||
cy.wait("@font").should(req => { | ||
expect(req.response.url).to.match(/merriweather-latin-300italic-/i) | ||
}) | ||
}) | ||
it(`should load image import`, () => { | ||
cy.wait("@img-import").should(req => { | ||
expect(req.response.statusCode).to.be.gte(200).and.lt(400) | ||
}) | ||
}) | ||
it(`should load file import`, () => { | ||
cy.getTestElement('assets-pdf-import').should('have.attr', 'href').and('match', /\/static\/pdf-example-.*\.pdf/i) | ||
}) | ||
} | ||
|
||
it(`should load static folder asset`, () => { | ||
cy.wait("@static-folder-image").should(req => { | ||
expect(req.response.statusCode).to.be.gte(200).and.lt(400) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as React from "react" | ||
import Layout from "../components/layout" | ||
import astronaut from "../images/gatsby-astronaut.png" | ||
import pdf from "../files/pdf-example.pdf" | ||
|
||
const Assets = () => ( | ||
<Layout> | ||
<h2 className="merriweather-300">Font</h2> | ||
<h2 className="merriweather-300-italic">Font Italic</h2> | ||
<img data-testid="assets-img-static-folder" src="../gatsby-astronaut.png" alt="Gatsby Astronaut Static Folder" /> | ||
<img data-testid="assets-img-import" src={astronaut} alt="Gatsby Astronaut" /> | ||
<a data-testid="assets-pdf-import" href={pdf}>Download PDF</a> | ||
</Layout> | ||
) | ||
|
||
export default Assets |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.foo { | ||
background: blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.