var path = require('path') , fs = require('fs') , ExtractTextPlugin = require('extract-text-webpack-plugin') module.exports = { module: { //加载器配置 rules: [ { test: /\.(scss|css)$/, use: ExtractTextPlugin.extract([ // 'style-loader', 'css-loader', 'sass-loader' ]) }, { test: /\.(js|jsx)$/, exclude: [ /node_modules/, /dist/ ], use: [ { loader: 'babel-loader', options: { ...JSON.parse(fs.readFileSync(path.resolve(__dirname, '../.babelrc'))), }, }, 'eslint-loader' ] }, { test: /\.(png|svg)$/, use: [ { loader: 'url-loader', options: { limit: 8192, name: '[name]_[hash:6].[ext]' } } ] }, { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, use: [ { loader: 'url-loader', options: { limit: 20000, name: '[name].[ext]', publicPath: './' } } ] } ] }, resolve: { modules: [path.resolve(__dirname, '../src'), 'node_modules'], alias: { 'react': path.join(__dirname, '../node_modules', 'react'), 'scssinc': path.join(__dirname, '../src/assets/scss/_inc.scss') }, extensions: ['.js', '.jsx'] } }