cli: added support for importing for files

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-08-31 19:16:26 +02:00
parent fec8900399
commit 5e803edb86
4 changed files with 47 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Added support for importing font files. Imports in CSS via `url()` are supported for the final frontend bundle, but not for packages that are built for publishing. Module imports of fonts files from TypeScript are supported everywhere.
+20
View File
@@ -68,6 +68,26 @@ declare module '*.svg' {
export default src;
}
declare module '*.eot' {
const src: string;
export default src;
}
declare module '*.woff' {
const src: string;
export default src;
}
declare module '*.woff2' {
const src: string;
export default src;
}
declare module '*.ttf' {
const src: string;
export default src;
}
declare module '*.css' {
const classes: { readonly [key: string]: string };
export default classes;
+11 -1
View File
@@ -80,7 +80,17 @@ export const makeConfigs = async (
postcss(),
forwardFileImports({
exclude: /\.icon\.svg$/,
include: [/\.svg$/, /\.png$/, /\.gif$/, /\.jpg$/, /\.jpeg$/],
include: [
/\.svg$/,
/\.png$/,
/\.gif$/,
/\.jpg$/,
/\.jpeg$/,
/\.eot$/,
/\.woff$/,
/\.woff2$/,
/\.ttf$/,
],
}),
json(),
yaml(),
@@ -89,6 +89,17 @@ export const transforms = (options: TransformOptions): Transforms => {
name: 'static/[name].[hash:8].[ext]',
},
},
{
test: /\.(eot|woff|woff2|ttf)$/,
use: [
{
loader: require.resolve('file-loader'),
options: {
name: 'static/[name].[hash:8].[ext]',
},
},
],
},
{
test: /\.ya?ml$/,
use: require.resolve('yml-loader'),