soapbox/webpack/rules/assets.js

81 wiersze
2.0 KiB
JavaScript
Czysty Zwykły widok Historia

// Asset modules
// https://webpack.js.org/guides/asset-modules/
const { resolve } = require('path');
// These are processed in reverse-order
// We use the name 'packs' instead of 'assets' for legacy reasons
module.exports = [{
test: /\.(png|svg)/,
type: 'asset/resource',
include: [
resolve('app', 'images'),
resolve('node_modules', 'emoji-datasource'),
],
generator: {
filename: 'packs/images/[name]-[contenthash:8][ext]',
},
}, {
test: /\.(ttf|eot|svg|woff|woff2)/,
type: 'asset/resource',
include: [
resolve('app', 'fonts'),
resolve('node_modules', 'fork-awesome'),
2021-09-27 04:09:19 +00:00
resolve('node_modules', 'line-awesome'),
resolve('node_modules', '@fontsource'),
],
generator: {
filename: 'packs/fonts/[name]-[contenthash:8][ext]',
},
}, {
test: /\.(ogg|oga|mp3)/,
type: 'asset/resource',
include: resolve('app', 'sounds'),
generator: {
filename: 'packs/sounds/[name]-[contenthash:8][ext]',
},
}, {
test: /\.svg$/,
type: 'asset/resource',
include: resolve('node_modules', 'twemoji'),
generator: {
filename: 'packs/emoji/[name]-[contenthash:8][ext]',
},
2021-09-20 20:33:28 +00:00
}, {
test: /\.svg$/,
2021-09-27 01:00:16 +00:00
type: 'asset/resource',
2021-09-20 22:05:59 +00:00
include: resolve('app', 'icons'),
2021-09-20 20:33:28 +00:00
generator: {
2021-09-27 01:00:16 +00:00
filename: 'packs/icons/[name]-[contenthash:8][ext]',
2021-09-20 20:33:28 +00:00
},
2021-09-21 01:49:24 +00:00
}, {
test: /\.svg$/,
2021-09-27 01:00:16 +00:00
type: 'asset/resource',
2021-09-21 01:49:24 +00:00
include: resolve('node_modules', 'bootstrap-icons'),
generator: {
2021-09-27 01:00:16 +00:00
filename: 'packs/icons/[name]-[contenthash:8][ext]',
2021-09-21 01:49:24 +00:00
},
}, {
test: /\.svg$/,
2021-09-27 01:00:16 +00:00
type: 'asset/resource',
2021-09-21 01:49:24 +00:00
include: resolve('node_modules', 'feather-icons'),
generator: {
2021-09-27 01:00:16 +00:00
filename: 'packs/icons/[name]-[contenthash:8][ext]',
2021-09-21 01:49:24 +00:00
},
2021-09-20 20:33:28 +00:00
}, {
test: /\.svg$/,
2021-09-27 01:00:16 +00:00
type: 'asset/resource',
2021-09-20 20:33:28 +00:00
include: resolve('node_modules', '@tabler'),
generator: {
2021-09-27 01:00:16 +00:00
filename: 'packs/icons/[name]-[contenthash:8][ext]',
2021-09-20 20:33:28 +00:00
},
}, {
test: /\.svg$/,
type: 'asset/resource',
include: resolve('node_modules', 'cryptocurrency-icons'),
generator: {
filename: 'packs/images/crypto/[name]-[contenthash:8][ext]',
},
}];