1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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']
- }
- }
|