webpack-contrib / style-loader

Style Loader
MIT License
1.66k stars 470 forks source link

Build not ok with injectType of style-loader #430

Closed Acksop closed 4 years ago

Acksop commented 4 years ago

Expected Behavior

npm run Build -->OK!

Actual Behavior

https://gist.github.com/Acksop/f5c39cb60d416b5660f3ea8df542c60c

Code

webpack.config.js https://gist.github.com/Acksop/9ba4bfc40ab3996d95cd4b9d3ae1546b

`src/entry-point.js`
//-- Import CSS Styles
import inlinestyles from './css/inline.css';
import lazystyles from './css/main.lazy.css';
import linkstyles from './css/plugins.link.css';

console.info('Saluto!');
alexander-akait commented 4 years ago

linkTag should be used with file-loader, please read docs, thanks

Acksop commented 4 years ago

thanks, i'm a newbie with npm ... I just begin to understand how it works. so thank for your help !

evolverine commented 4 years ago

Sure, but this way one can't process the urls inside the css, no? Or am I missing something?

evolverine commented 4 years ago

Found a solution to my issue, using extract-loader

     {
        test: /\.css$/i,
        use: [{ loader: "style-loader", options: { injectType: "linkTag" } },
        "file-loader",
        "extract-loader",
        "css-loader"
       ],
    },