mirror of
https://github.com/thelounge/thelounge.git
synced 2024-05-23 08:32:15 +02:00
dd05ee3a65
Co-authored-by: Eric Nemchik <eric@nemchik.com> Co-authored-by: Pavel Djundik <xPaw@users.noreply.github.com>
12 lines
492 B
TypeScript
12 lines
492 B
TypeScript
// This creates a version of `require()` in the context of the current
|
|
// directory, so we iterate over its content, which is a map statically built by
|
|
// Webpack.
|
|
// Second argument says it's recursive, third makes sure we only load templates.
|
|
const requireViews = require.context(".", false, /\.vue$/);
|
|
|
|
export default requireViews.keys().reduce((acc: Record<string, any>, path) => {
|
|
acc["message-" + path.substring(2, path.length - 4)] = requireViews(path).default;
|
|
|
|
return acc;
|
|
}, {});
|