diff --git a/docs/.storybook/webpack.config.js b/docs/.storybook/webpack.config.js index 65ab1ce95c78..6fa4499e321b 100644 --- a/docs/.storybook/webpack.config.js +++ b/docs/.storybook/webpack.config.js @@ -10,9 +10,16 @@ const config = { use: ['json-loader', 'yaml-loader'], }, { - test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)$/, + test: /\.(jpg|png|gif|eot|ttf|woff|woff2)$/, use: ['file-loader'], }, + { + test: /\.svg$/, + loader: 'svg-url-loader', + options: { + noquotes: true, + }, + }, ], }, }; diff --git a/examples/vue-kitchen-sink/package.json b/examples/vue-kitchen-sink/package.json index 5363d9769ed8..dd0a9cb71c98 100644 --- a/examples/vue-kitchen-sink/package.json +++ b/examples/vue-kitchen-sink/package.json @@ -30,6 +30,7 @@ "babel-preset-vue": "^2.0.1", "cross-env": "^5.1.4", "file-loader": "^1.1.11", + "svg-url-loader": "^2.3.2", "vue-loader": "^14.2.1", "webpack": "^3.11.0", "webpack-dev-server": "^2.11.2" diff --git a/examples/vue-kitchen-sink/webpack.config.js b/examples/vue-kitchen-sink/webpack.config.js index a6f520b135e5..5791e9ab0a02 100644 --- a/examples/vue-kitchen-sink/webpack.config.js +++ b/examples/vue-kitchen-sink/webpack.config.js @@ -24,12 +24,19 @@ module.exports = { exclude: /node_modules/, }, { - test: /\.(png|jpg|gif|svg)$/, + test: /\.(png|jpg|gif)$/, loader: 'file-loader', options: { name: '[name].[ext]?[hash]', }, }, + { + test: /\.svg$/, + loader: 'svg-url-loader', + options: { + noquotes: true, + }, + }, ], }, resolve: { diff --git a/lib/core/package.json b/lib/core/package.json index 48571bbd70e0..4f62cea7f24a 100644 --- a/lib/core/package.json +++ b/lib/core/package.json @@ -42,6 +42,7 @@ "serve-favicon": "^2.4.5", "shelljs": "^0.8.1", "style-loader": "^0.20.3", + "svg-url-loader": "^2.3.2", "url-loader": "^0.6.2", "webpack": "^3.11.0", "webpack-dev-middleware": "^1.12.2", diff --git a/lib/core/src/server/config/defaults/webpack.config.js b/lib/core/src/server/config/defaults/webpack.config.js index a83800ab86bb..a7f32da71eb9 100644 --- a/lib/core/src/server/config/defaults/webpack.config.js +++ b/lib/core/src/server/config/defaults/webpack.config.js @@ -37,12 +37,19 @@ export function createDefaultWebpackConfig(storybookBaseConfig) { loader: require.resolve('json-loader'), }, { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, + test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2)(\?.*)?$/, loader: require.resolve('file-loader'), query: { name: 'static/media/[name].[hash:8].[ext]', }, }, + { + test: /\.svg$/, + loader: require.resolve('svg-url-loader'), + options: { + noquotes: true, + }, + }, { test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, loader: require.resolve('url-loader'), diff --git a/yarn.lock b/yarn.lock index 7e8a85899341..9d82ad6875ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6038,6 +6038,13 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +file-loader@1.1.11, file-loader@^1.1.11: + version "1.1.11" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.11.tgz#6fe886449b0f2a936e43cabaac0cdbfb369506f8" + dependencies: + loader-utils "^1.0.2" + schema-utils "^0.4.5" + file-loader@1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.5.tgz#91c25b6b6fbe56dae99f10a425fd64933b5c9daa" @@ -6045,13 +6052,6 @@ file-loader@1.1.5: loader-utils "^1.0.2" schema-utils "^0.3.0" -file-loader@^1.1.11: - version "1.1.11" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.11.tgz#6fe886449b0f2a936e43cabaac0cdbfb369506f8" - dependencies: - loader-utils "^1.0.2" - schema-utils "^0.4.5" - file-loader@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.6.tgz#7b9a8f2c58f00a77fddf49e940f7ac978a3ea0e8" @@ -15187,6 +15187,13 @@ svg-tags@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" +svg-url-loader@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/svg-url-loader/-/svg-url-loader-2.3.2.tgz#dd86b26c19fe3b914f04ea10ef39594eade04464" + dependencies: + file-loader "1.1.11" + loader-utils "1.1.0" + svgo@^0.7.0: version "0.7.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-0.7.2.tgz#9f5772413952135c6fefbf40afe6a4faa88b4bb5"