1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

How to publish angular library with images using webpack convert them into js files

Discussão em 'Angular' iniciado por user27321200, Setembro 14, 2024.

  1. user27321200

    user27321200 Guest

    When I use webpack5 convert images into base64 webpack.config.js

    module: {
    rules: [
    {
    test: /\.(svg|png)$/i,
    type: 'asset/source',
    },
    {
    resourceQuery: /raw/,
    type: 'asset/source',
    },
    ],
    },


    app.component.ts

    lazyloadFunc(name) {
    import(`./icons/${name}.svg?raw`).then((module) => {
    this.svgContent = this.sanitizer.bypassSecurityTrustHtml(module.default);
    this.cdr.detectChanges();
    });
    }


    It works on localhost, but when I use in other project I got some errors ; errors

    Package path ./styles/icons is not exported from package ...
    (see exports field in ... \package.json)


    how to publish angular library with images?

    Continue reading...

Compartilhe esta Página