Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix svg loading #5924

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions examples/cra-kitchen-sink/src/stories/cra-svgr.stories.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// FIXME: @igor-dv
import React from 'react';
import { storiesOf } from '@storybook/react';
import { ReactComponent as Logo } from '../logo.svg';

// import React from 'react';
// import { storiesOf } from '@storybook/react';
// import { ReactComponent as Logo } from '../logo.svg';
//
// storiesOf('CRA', module).add('Svgr', () => <Logo />);
storiesOf('CRA', module).add('Svgr', () => <Logo />);
2 changes: 2 additions & 0 deletions examples/official-storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@storybook/node-logger": "5.1.0-alpha.0",
"@storybook/react": "5.1.0-alpha.0",
"@storybook/theming": "5.1.0-alpha.0",
"@svgr/webpack": "^4.1.0",
"cors": "^2.8.5",
"cross-env": "^5.2.0",
"enzyme-to-json": "^3.3.5",
Expand All @@ -52,6 +53,7 @@
"react-dom": "^16.8.3",
"storybook-chromatic": "^1.2.6",
"ts-loader": "^5.3.3",
"url-loader": "^1.1.2",
"uuid": "^3.3.2",
"webpack": "^4.29.6"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions examples/official-storybook/stories/core/webpack.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import { ReactComponent as Logo } from './storybook-logo.svg';

export default {
title: 'Core|Webpack',
};

export const svg = () => <Logo />;
svg.title = 'SVG Loader';
4 changes: 4 additions & 0 deletions examples/official-storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module.exports = async ({ config }) => ({
module: {
...config.module,
rules: [
{
test: /\.svg$/,
use: ['@svgr/webpack'],
},
...config.module.rules,
{
test: /\.stories\.jsx?$/,
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
cacheDirectory: '.cache/jest',
clearMocks: true,
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'\\.(svg|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js',
'\\.(md)$': '<rootDir>/__mocks__/htmlMock.js',
Expand Down
4 changes: 3 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,7 @@
merge-deep "^3.0.2"
svgo "^1.1.1"

"@svgr/[email protected]", "@svgr/webpack@^4.0.3":
"@svgr/[email protected]", "@svgr/webpack@^4.0.3", "@svgr/webpack@^4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@svgr/webpack/-/webpack-4.1.0.tgz#20c88f32f731c7b1d4711045b2b993887d731c28"
integrity sha512-d09ehQWqLMywP/PT/5JvXwPskPK9QCXUjiSkAHehreB381qExXf5JFCBWhfEyNonRbkIneCeYM99w+Ud48YIQQ==
Expand Down Expand Up @@ -11139,6 +11139,7 @@ graphql-request@^1.5.0:
graphql@^0.13.2, graphql@^14.1.1:
version "0.13.2"
resolved "https://registry.yarnpkg.com/graphql/-/graphql-0.13.2.tgz#4c740ae3c222823e7004096f832e7b93b2108270"
integrity sha512-QZ5BL8ZO/B20VA8APauGBg3GyEgZ19eduvpLWoq5x7gMmWnHoy8rlQWPLmWgFvo1yNgjSEFMesmS4R6pPr7xog==
dependencies:
iterall "^1.2.1"

Expand Down Expand Up @@ -12822,6 +12823,7 @@ [email protected]:
iterall@^1.2.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7"
integrity sha512-yynBb1g+RFUPY64fTrFv7nsjRrENBQJaX2UL+2Szc9REFrSNm1rpSXHGzhmAy7a9uv3vlvgBlXnf9RqmPH1/DA==

jasmine-core@~2.8.0:
version "2.8.0"
Expand Down