Skip to content

Commit

Permalink
Added support for loading images via webpack config (#276)
Browse files Browse the repository at this point in the history
* Fixed issue where duplicate versions of the import map overrides were used
Upgraded dependencies

* Added image loading via asset/resource

* Changeset for the inclusion of images in the webpack config

* Added check for React before adding svg types

* Removed React component declaration

Co-authored-by: Pieter Boeren <p.boeren@vicrea.nl>
  • Loading branch information
PieterBoeren and Pieter Boeren authored Apr 9, 2021
1 parent 01bf3ae commit 337d8dd
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 1,158 deletions.
6 changes: 6 additions & 0 deletions .changeset/shiny-shrimps-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"generator-single-spa": patch
"webpack-config-single-spa": patch
---

Added support for images in the webpack config

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
declare module "*.html" {
const rawHtmlFile: string;
export = rawHtmlFile;
}

declare module "*.bmp" {
const src: string;
export default src;
}

declare module "*.gif" {
const src: string;
export default src;
}

declare module "*.jpg" {
const src: string;
export default src;
}

declare module "*.jpeg" {
const src: string;
export default src;
}

declare module "*.png" {
const src: string;
export default src;
}

declare module "*.webp" {
const src: string;
export default src;
}

declare module "*.svg" {
const src: string;
export default src;
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ function webpackConfigSingleSpa(opts) {
},
],
},
{
test: /\.(bmp|png|svg|jpg|jpeg|gif|webp)$/i,
exclude: /node_modules/,
type: "asset/resource",
},
{
test: /\.html$/i,
exclude: /node_modules/,
use: [require.resolve("raw-loader", { paths: [__dirname] })],
type: "asset/source",
},
],
},
Expand Down
1 change: 0 additions & 1 deletion packages/webpack-config-single-spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"babel-loader": "^8.2.2",
"css-loader": "^5.0.1",
"html-webpack-plugin": "^5.1.0",
"raw-loader": "^4.0.2",
"standalone-single-spa-webpack-plugin": "^1.1.0",
"style-loader": "^2.0.0",
"systemjs-webpack-interop": "^2.3.2",
Expand Down
Loading

0 comments on commit 337d8dd

Please sign in to comment.