mercredi 27 juillet 2016

Webpack resolve svg

Installed in node:

npm install svg-url-loader --save

I have added to the webpack.config.js:

module: {
    loaders: [
        { test: /.css$/, loader: "style-loader!css-loader" },
        {test: /.svg/, loader: 'svg-url-loader'},
    ]
}

To the Page.jsx:

require("svg-url!C:/../WebApp/main_page_assets/02_general_alerts_icons.svg");
require("C:/../WebApp/css/dashboard/dashboard.css");

And in my css:

.test {
    background: url('../../main_page_assets/02_general_alerts_icons.svg');
    background-repeat: no-repeat;
}

And I receive:

ERROR in ./~/css-loader!../css/dashboard/dashboard.css
Module not found: Error: Cannot resolve module 'svg-url-loader' in C:..W
bAppcssdashboard
 @ ./~/css-loader!../css/dashboard/dashboard.css 6:74-135

What can be the reason? Paths issues? i have been playing with the paths back and forth and cant make it work

Aucun commentaire:

Enregistrer un commentaire