webpack resource loading common configuration

the require path = const ( 'path' ); 

module.exports = { 
  entry: './src/index.js' , 
  Output: { 
    filename: 'bundle.js' , 
    path: path.resolve (__ dirname, 'dist' ) 
  }, 
  Module1: { 

      the rules: [ 
              @    CSS loading 
    // package download command: the install --save NPM-dev-Loader CSS-style Loader 
          { 
          Test: /\.css$/ , 
          use: [
               'style-Loader' ,
               'CSS-loader' , 
          ] 
      }, 
          //    load images and fonts loaded 
    //Package download command: the install --save NPM-dev-Loader File 
      { 
          Test: /\.(png|jpg|gif)$/ , 
          use: [
               'File-Loader' 
          ] 
      }, 
      { 
          Test: / \ (WOFF |. woff2 | EOT | TTF | OTF) $ / , 
          use: [
               'File-Loader' 
          ] 
      }, 
    //    loading (JSON is built in, there is no need to download the corresponding packet) 
    // packet command: npm install --save- Loader-XML CSV-dev Loader 
      { 
        Test: /\.xml$/ , 
        use: [
             'XML-Loader' 
        ] 
    }, 
    { 
        Test: /\.(csv|tsv)$/ ,
        use:[
            'csv-loader'
        ]
    }
    ]
  }
};

 

Guess you like

Origin www.cnblogs.com/angle-xiu/p/11774312.html