07webpack-- download module corresponding css

<! - This section loader configuration process css style 
   
   to create a new index.css under the src css css folder in 
   the introduction and css js module main.js Yangsi table this entry is different file 

   import file in main.js ' ./css/index.css' 

   Note: webpack default file processing can only be packaged JS type of non-JS can not handle other types of files 
         if dealing with other types of non-js files need to install third-party loader the 
         CNPM i style -loader Loader-css - D need to cool the two loader processing module hungry css 

    open the file webpack.config.js       
    add a node disposed on the inside, is that he is an object module in the object module, 
    it has a property the rules, this property is an array in the array, all of the stored third-party file and the processing rule matching 

    webpack.config.js following documents 
    Module1: { // this third-party node configuration for all loader 

    rules: [ // All third-party modules matching rules
      Test {: /\.css$/, use: [ 'style-loader', 'css-loader' ]} 
       ] 
    } 
   
    PS ==> loading test rules from right to left in the loader to load Oh css-loader loading style-loader

 

Guess you like

Origin www.cnblogs.com/IwishIcould/p/11432609.html