forked from facebook/create-react-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfileTransform.js
More file actions
28 lines (24 loc) · 747 Bytes
/
fileTransform.js
File metadata and controls
28 lines (24 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// @remove-on-eject-begin
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// @remove-on-eject-end
'use strict';
const path = require('path');
// This is a custom Jest transformer turning file imports into filenames.
// http://facebook.github.io/jest/docs/en/webpack.html
module.exports = {
process(src, filename) {
if (filename.match(/\.svg$/)) {
return `module.exports = {
__esModule: true,
default: ${JSON.stringify(path.basename(filename))},
ReactComponent: () => null
};`;
}
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};