From cd30ac23028bbcf1ff4b5f70737d202a5483d9c9 Mon Sep 17 00:00:00 2001 From: emilpalsson Date: Fri, 10 Nov 2017 15:31:03 +0100 Subject: [PATCH] Add support for fonts in plugin-bundler-webpack, closes #1190 --- packages/plugin-bundler-webpack/package.json | 1 + packages/plugin-bundler-webpack/src/webpack.config.js | 11 +++++++++++ yarn.lock | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/packages/plugin-bundler-webpack/package.json b/packages/plugin-bundler-webpack/package.json index 703bc2d9f..8467beea7 100644 --- a/packages/plugin-bundler-webpack/package.json +++ b/packages/plugin-bundler-webpack/package.json @@ -28,6 +28,7 @@ "babel-loader": "^7.0.0", "chalk": "^1.1.3", "css-loader": "^0.28.0", + "file-loader": "^1.1.5", "debug": "^2.6.0", "extract-text-webpack-plugin": "^3.0.0", "find-cache-dir": "^0.1.1", diff --git a/packages/plugin-bundler-webpack/src/webpack.config.js b/packages/plugin-bundler-webpack/src/webpack.config.js index 18a9ce40d..b63c9e75f 100644 --- a/packages/plugin-bundler-webpack/src/webpack.config.js +++ b/packages/plugin-bundler-webpack/src/webpack.config.js @@ -44,6 +44,17 @@ module.exports = (config: PhenomicConfig) => ({ fallback: require.resolve("style-loader"), use: require.resolve("css-loader") }) + }, + { + test: /\.(eot|svg|ttf|woff|woff2)$/, + use: [ + { + loader: require.resolve("file-loader"), + options: { + name: "phenomic/fonts/[name].[hash:8].[ext]" + } + } + ] } ] }, diff --git a/yarn.lock b/yarn.lock index aedc546df..a0d001346 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3452,6 +3452,13 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +file-loader@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-1.1.5.tgz#91c25b6b6fbe56dae99f10a425fd64933b5c9daa" + dependencies: + loader-utils "^1.0.2" + schema-utils "^0.3.0" + filename-regex@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26"