Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a865f5b

Browse files
authoredOct 23, 2017
Merge pull request #787 from airbnb/jdl-remove-webpack
Replace svg-loader with babel-plugin-inline-react-svg
2 parents 38424ad + d244b20 commit a865f5b

18 files changed

+44
-116
lines changed
 

‎.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"presets": ["airbnb"],
33
"plugins": [
4+
"inline-react-svg",
45
["transform-replace-object-assign", "object.assign"],
56
],
67
"env": {

‎karma.conf.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,6 @@ module.exports = (config) => {
4141
presets: ['airbnb'],
4242
},
4343
},
44-
{
45-
test: /\.svg$/,
46-
use: [
47-
{
48-
loader: 'babel-loader',
49-
query: {
50-
presets: ['airbnb'],
51-
},
52-
},
53-
{
54-
loader: 'react-svg-loader',
55-
query: {
56-
jsx: true,
57-
},
58-
},
59-
],
60-
include: [
61-
path.join(__dirname, 'src'),
62-
],
63-
},
6444
{ test: /\.json$/, loader: 'json-loader' },
6545

6646
// Inject the Airbnb shims into the bundle

‎package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
"description": "A responsive and accessible date range picker component built with React",
55
"main": "index.js",
66
"scripts": {
7-
"build": "npm run clean && npm run build:js && npm run build:svg && npm run build:css -- --optimize ",
8-
"build:js": "babel src/ -d lib/ --ignore src/components",
7+
"build": "npm run clean && npm run build:js && npm run build:css -- --optimize ",
8+
"build:js": "babel src/ -d lib/",
99
"prebuild:css": "rimraf lib/css && mkdir -p lib/css",
1010
"build:css": "node scripts/buildCSS.js",
11-
"build:svg": "webpack",
1211
"clean": "rimraf lib",
1312
"precover": "rimraf coverage",
1413
"cover": "cross-env NODE_ENV=test node --max-old-space-size=2048 $(which nyc) npm run mocha test",
1514
"lint": "eslint --ext .js,.jsx src test",
1615
"mocha": "mocha ./test/_helpers",
17-
"storybook:uninstall": "npm uninstall --no-save @storybook/react && rimraf node_modules/@storybook node_modules/react-modal node_modules/react-dom-factories node_modules/react-svg-loader",
16+
"storybook:uninstall": "npm uninstall --no-save @storybook/react && rimraf node_modules/@storybook node_modules/react-modal node_modules/react-dom-factories",
1817
"react:clean": "npm run storybook:uninstall && npm i --no-save ajv ajv-keywords && npm uninstall --no-save react react-dom react-addons-test-utils react-test-renderer && rimraf node_modules/react-test-renderer node_modules/react && npm prune",
1918
"react:14": "rimraf node_modules/.bin/npm && npm run react:clean && npm i --no-save react@0.14 react-dom@0.14 react-addons-test-utils@0.14 enzyme-adapter-react-14 && npm run storybook:uninstall && npm prune && npm i --no-save enzyme-adapter-react-14",
2019
"react:15": "rimraf node_modules/.bin/npm && npm run react:clean && npm i --no-save react@15 react-dom@15 react-addons-test-utils@15 react-test-renderer@15 && npm run storybook:uninstall && npm prune",
@@ -60,6 +59,7 @@
6059
"babel-cli": "^6.26.0",
6160
"babel-core": "^6.26.0",
6261
"babel-loader": "^6.4.1",
62+
"babel-plugin-inline-react-svg": "^0.4.0",
6363
"babel-plugin-istanbul": "^4.1.5",
6464
"babel-plugin-syntax-jsx": "^6.18.0",
6565
"babel-plugin-transform-replace-object-assign": "^0.2.1",
@@ -98,7 +98,6 @@
9898
"react-addons-shallow-compare": "^0.14 || ^15.5.2",
9999
"react-addons-test-utils": "^0.14 || ^15.5.1",
100100
"react-dom": "^0.14 || ^15.5.4",
101-
"react-svg-loader": "^1.1.1",
102101
"react-test-renderer": "^15.6.1",
103102
"react-with-styles-interface-aphrodite": "^3.1.1",
104103
"react-with-styles-interface-css-compiler": "^1.0.1",

‎src/components/CalendarIcon.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react'; // eslint-disable-line no-unused-vars
2+
import CalendarIcon from '../svg/calendar.svg';
3+
4+
export default CalendarIcon;

‎src/components/ChevronDown.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react'; // eslint-disable-line no-unused-vars
2+
import ChevronDown from '../svg/chevron-down.svg';
3+
4+
export default ChevronDown;

‎src/components/ChevronUp.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react'; // eslint-disable-line no-unused-vars
2+
import ChevronUp from '../svg/chevron-up.svg';
3+
4+
export default ChevronUp;

‎src/components/CloseButton.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react'; // eslint-disable-line no-unused-vars
2+
import CloseButton from '../svg/close.svg';
3+
4+
export default CloseButton;

‎src/components/DateRangePicker.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import isInclusivelyAfterDay from '../utils/isInclusivelyAfterDay';
1717
import DateRangePickerInputController from './DateRangePickerInputController';
1818
import DayPickerRangeController from './DayPickerRangeController';
1919

20-
import CloseButton from '../svg/close.svg';
20+
import CloseButton from './CloseButton';
2121

2222
import DateRangePickerShape from '../shapes/DateRangePickerShape';
2323

‎src/components/DateRangePickerInput.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import openDirectionShape from '../shapes/OpenDirectionShape';
1010
import DateInput from './DateInput';
1111
import IconPositionShape from '../shapes/IconPositionShape';
1212

13-
import RightArrow from '../svg/arrow-right.svg';
14-
import LeftArrow from '../svg/arrow-left.svg';
15-
import CloseButton from '../svg/close.svg';
16-
import CalendarIcon from '../svg/calendar.svg';
13+
import RightArrow from './RightArrow';
14+
import LeftArrow from './LeftArrow';
15+
import CloseButton from './CloseButton';
16+
import CalendarIcon from './CalendarIcon';
1717

1818
import {
1919
START_DATE,

‎src/components/DayPickerKeyboardShortcuts.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import KeyboardShortcutRow from './KeyboardShortcutRow';
88
import { DayPickerKeyboardShortcutsPhrases } from '../defaultPhrases';
99
import getPhrasePropTypes from '../utils/getPhrasePropTypes';
1010

11-
import CloseButton from '../svg/close.svg';
11+
import CloseButton from './CloseButton';
1212

1313
export const TOP_LEFT = 'top-left';
1414
export const TOP_RIGHT = 'top-right';

‎src/components/DayPickerNavigation.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { css, withStyles, withStylesPropTypes } from 'react-with-styles';
66
import { DayPickerNavigationPhrases } from '../defaultPhrases';
77
import getPhrasePropTypes from '../utils/getPhrasePropTypes';
88

9-
import LeftArrow from '../svg/arrow-left.svg';
10-
import RightArrow from '../svg/arrow-right.svg';
11-
import ChevronUp from '../svg/chevron-up.svg';
12-
import ChevronDown from '../svg/chevron-down.svg';
9+
import LeftArrow from './LeftArrow';
10+
import RightArrow from './RightArrow';
11+
import ChevronUp from './ChevronUp';
12+
import ChevronDown from './ChevronDown';
1313
import ScrollableOrientationShape from '../shapes/ScrollableOrientationShape';
1414

1515
import {

‎src/components/LeftArrow.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react'; // eslint-disable-line no-unused-vars
2+
import LeftArrow from '../svg/arrow-left.svg';
3+
4+
export default LeftArrow;

‎src/components/RightArrow.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react'; // eslint-disable-line no-unused-vars
2+
import RightArrow from '../svg/arrow-right.svg';
3+
4+
export default RightArrow;

‎src/components/SingleDatePicker.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import getResponsiveContainerStyles from '../utils/getResponsiveContainerStyles'
1717
import SingleDatePickerInput from './SingleDatePickerInput';
1818
import DayPickerSingleDateController from './DayPickerSingleDateController';
1919

20-
import CloseButton from '../svg/close.svg';
20+
import CloseButton from './CloseButton';
2121

2222
import isInclusivelyAfterDay from '../utils/isInclusivelyAfterDay';
2323

‎src/components/SingleDatePickerInput.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import getPhrasePropTypes from '../utils/getPhrasePropTypes';
99
import DateInput from './DateInput';
1010
import IconPositionShape from '../shapes/IconPositionShape';
1111

12-
import CloseButton from '../svg/close.svg';
13-
import CalendarIcon from '../svg/calendar.svg';
12+
import CloseButton from './CloseButton';
13+
import CalendarIcon from './CalendarIcon';
1414

1515
import openDirectionShape from '../shapes/OpenDirectionShape';
1616
import { ICON_BEFORE_POSITION, ICON_AFTER_POSITION, OPEN_DOWN } from '../../constants';

‎test/components/DayPickerKeyboardShortcuts_spec.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import sinon from 'sinon-sandbox';
44
import { shallow } from 'enzyme';
55

66
import { DayPickerKeyboardShortcutsPhrases } from '../../src/defaultPhrases';
7-
import CloseButton from '../../src/svg/close.svg';
7+
import CloseButton from '../../src/components/CloseButton';
88

99
import KeyboardShortcutRow from '../../src/components/KeyboardShortcutRow';
1010
import DayPickerKeyboardShortcuts from '../../src/components/DayPickerKeyboardShortcuts';

‎test/components/SingleDatePicker_spec.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import sinon from 'sinon-sandbox';
55
import moment from 'moment';
66
import Portal from 'react-portal';
77

8-
import CloseButton from '../../src/svg/close.svg';
8+
import CloseButton from '../../src/components/CloseButton';
99
import DayPickerSingleDateController from '../../src/components/DayPickerSingleDateController';
1010
import SingleDatePickerInput from '../../src/components/SingleDatePickerInput';
1111
import SingleDatePicker, { PureSingleDatePicker } from '../../src/components/SingleDatePicker';

‎webpack.config.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.