Skip to content

Commit

Permalink
auspice-client: Use import for image file
Browse files Browse the repository at this point in the history
The new version of Auspice (which uses Webpack v5) uses a built-in Asset
Module (asset/resource) to handle files that were previously handled
with file-loader¹.

file-loader in Webpack v4 is documented to handle both import and
require()². Based on docs which suggest that asset/resource directly
replaces file-loader³, I'd expect it to also support require(). It seems
like that is not the case, so this is a workaround.

¹ nextstrain/auspice@7892c59
² https://v4.webpack.js.org/loaders/file-loader/
³ https://webpack.js.org/guides/asset-modules/
  • Loading branch information
victorlin authored and jameshadfield committed Dec 15, 2022
1 parent 7cde839 commit 238dce3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion auspice-client/customisations/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from "react"; // eslint-disable-line
import LanguageSelector from "./languageSelector.js";

const logoPNG = require("./nextstrain-logo-small.png");
import logoPNG from "./nextstrain-logo-small.png";

/* This code is straight from the auspice repo.
* There are theme props available if one used styled components here
Expand Down

0 comments on commit 238dce3

Please sign in to comment.