-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.mjs
44 lines (41 loc) · 1.38 KB
/
next.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** @type {import('next').NextConfig} */
// next.config.mjs
import urlLoader from "url-loader";
import fileLoader from "file-loader";
// Define your Next.js configuration object
const nextConfig = {
images: {
domains: ["images.igdb.com"],
},
webpack(config, { isServer }) {
// Push a new rule for audio files
config.module.rules.push({
test: /\.(mp3|wav|mpe?g)$/i,
exclude: config.exclude,
use: [
{
// Use the string identifier for the loader instead of importing it
loader: "url-loader",
options: {
limit: false,
fallback: "file-loader", // Specify the fallback loader as a string
publicPath: `${config.assetPrefix || ""}/_next/static/images/`,
outputPath: `${isServer ? "../" : ""}static/images/`,
name: "[name]-[hash].[ext]",
esModule: config.esModule || false,
},
},
],
});
config.resolve.extensionAlias = {
// Your existing alias configurations
// Adding '.mp3' alongside other formats
".mp3": [".mp3"], // Technically, for .mp3 files, this is straightforward, but you might want to consider a broader audio setup
// Any other extension aliases can go below
};
return config;
},
// Adding custom Webpack conf
};
// Export your configuration object with ESM syntax
export default nextConfig;