diff --git a/package.json b/package.json
index b02d9563a..043c4839b 100644
--- a/package.json
+++ b/package.json
@@ -91,7 +91,7 @@
"style-loader": "^0.23.1",
"toml-loader": "^1.0.0",
"typescript": "^3.9.2",
- "url-loader": "^1.0.1",
+ "url-loader": "^4.1.0",
"webpack": "^4.42.0",
"webpack-bundle-analyzer": "^3.7.0",
"webpack-cli": "^3.1.2",
diff --git a/publicodes/source/components/rule/References.tsx b/publicodes/source/components/rule/References.tsx
index f7e7bda47..9d0281adc 100644
--- a/publicodes/source/components/rule/References.tsx
+++ b/publicodes/source/components/rule/References.tsx
@@ -1,9 +1,22 @@
-import references from './références/références.yaml'
import { toPairs } from 'ramda'
import React from 'react'
import { capitalise0 } from '../../utils'
import styled from 'styled-components'
+const references = {
+ 'service-public.fr': require('url-loader!./références/marianne.png').default,
+ 'urssaf.fr': require('url-loader!./références/URSSAF.png').default,
+ 'gouv.fr': require('url-loader!./références/marianne.png').default,
+ 'agirc-arrco.fr': require('url-loader!./références/agirc-arrco.png').default,
+ 'pole-emploi.fr': require('url-loader!./références/pole-emploi.png').default,
+ 'ladocumentationfrançaise.fr': require('url-loader!./références/ladocumentationfrançaise.png')
+ .default,
+ 'senat.fr': require('url-loader!./références/senat.png').default,
+ 'ameli.fr': require('url-loader!./références/ameli.png').default,
+ 'bpifrance-creation': require('url-loader!./références/bpi-création.png')
+ .default
+}
+
const findRefKey = (link: string) =>
Object.keys(references).find(r => link.includes(r))
@@ -20,20 +33,17 @@ type RefProps = {
function Ref({ name, link }: RefProps) {
const refKey = findRefKey(link),
- refData = (refKey && references[refKey]) || {},
domain = cleanDomain(link)
return (
- {refData.image && (
-
- )}
+ {refKey && }
({
]
})
-module.exports.commonLoaders = ({ legacy = false } = {}) => {
+module.exports.commonLoaders = ({ legacy = false, file = true } = {}) => {
const babelLoader = {
loader: 'babel-loader',
options: {
@@ -49,15 +49,22 @@ module.exports.commonLoaders = ({ legacy = false } = {}) => {
use: babelLoader,
exclude: /node_modules|dist/
},
- {
- test: /\.(jpe?g|png|svg)$/,
- use: {
- loader: 'file-loader',
- options: {
- name: 'images/[name].[ext]'
- }
- }
- },
+ ...(file
+ ? [
+ {
+ test: /\.(jpe?g|png|svg)$/,
+ use: [
+ {
+ loader: 'url-loader',
+ options: {
+ limit: 8192,
+ name: 'images/[name].[ext]'
+ }
+ }
+ ]
+ }
+ ]
+ : []),
{
test: /\.yaml$/,
use: ['json-loader', 'yaml-loader']
diff --git a/yarn.lock b/yarn.lock
index 425add821..7887ed7cd 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7281,6 +7281,15 @@ loader-utils@^1.0.0, loader-utils@^1.0.2, loader-utils@^1.1.0, loader-utils@^1.2
emojis-list "^3.0.0"
json5 "^1.0.1"
+loader-utils@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0"
+ integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==
+ dependencies:
+ big.js "^5.2.2"
+ emojis-list "^3.0.0"
+ json5 "^2.1.2"
+
locate-path@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e"
@@ -7627,7 +7636,7 @@ mime-types@2.1.18:
dependencies:
mime-db "~1.33.0"
-mime-types@^2.1.12, mime-types@~2.1.19, mime-types@~2.1.24:
+mime-types@^2.1.12, mime-types@^2.1.26, mime-types@~2.1.19, mime-types@~2.1.24:
version "2.1.27"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f"
integrity sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==
@@ -11599,14 +11608,14 @@ url-join@^2.0.5:
resolved "https://registry.yarnpkg.com/url-join/-/url-join-2.0.5.tgz#5af22f18c052a000a48d7b82c5e9c2e2feeda728"
integrity sha1-WvIvGMBSoACkjXuCxenC4v7tpyg=
-url-loader@^1.0.1:
- version "1.1.2"
- resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-1.1.2.tgz#b971d191b83af693c5e3fea4064be9e1f2d7f8d8"
- integrity sha512-dXHkKmw8FhPqu8asTc1puBfe3TehOCo2+RmOOev5suNCIYBcT626kxiWg1NBVkwc4rO8BGa7gP70W7VXuqHrjg==
+url-loader@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-4.1.0.tgz#c7d6b0d6b0fccd51ab3ffc58a78d32b8d89a7be2"
+ integrity sha512-IzgAAIC8wRrg6NYkFIJY09vtktQcsvU8V6HhtQj9PTefbYImzLB1hufqo4m+RyM5N3mLx5BqJKccgxJS+W3kqw==
dependencies:
- loader-utils "^1.1.0"
- mime "^2.0.3"
- schema-utils "^1.0.0"
+ loader-utils "^2.0.0"
+ mime-types "^2.1.26"
+ schema-utils "^2.6.5"
url@0.11.0, url@^0.11.0:
version "0.11.0"