Skip to content

Commit c989c67

Browse files
committed
add raw-loader
1 parent a20cd92 commit c989c67

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

build/webpack-config/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const paths = require('../base-config/path');
33

44
const alias = require('./alias')(paths);
55
const base = require('./base')(paths);
6-
const loaders = require('./loaders')();
6+
const rules = require('./loaders')();
77
const plugins = require('./plugins')(paths);
88

99
debug('Creating configuration.');
@@ -14,7 +14,7 @@ module.exports = Object.assign(
1414
alias,
1515
},
1616
module: {
17-
loaders,
17+
rules,
1818
},
1919
},
2020
base

build/webpack-config/loaders.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,34 @@ module.exports = () => {
6262
{
6363
loader: 'url-loader',
6464
options: {
65-
limit: 8192,
65+
limit: 1024 * 4,
6666
useRelativePath: isProd,
6767
name: `images/[name].${env.config.hash}.[ext]`,
6868
},
6969
},
7070
],
7171
},
72+
{
73+
test: /\.(woff|woff2|otf|ttf|eot)(\?.*)?$/,
74+
use: [
75+
{
76+
loader: 'url-loader',
77+
options: {
78+
limit: 1024 * 10,
79+
useRelativePath: isProd,
80+
name: `fonts/[name].${env.config.hash}.[ext]`,
81+
},
82+
},
83+
],
84+
},
85+
{
86+
test: /\.(txt|svg)$/,
87+
use: [
88+
{
89+
loader: 'raw-loader',
90+
},
91+
],
92+
},
7293
];
7394
if (!isDev) {
7495
debug('Apply ExtractTextPlugin to CSS loaders.');

0 commit comments

Comments
 (0)