#Setting up Bun aliases similar to Webpack's for NextJS

1 messages · Page 1 of 1 (latest)

indigo sun
#

At the moment I have the following Webpack configuration that allows me to replace repetitive ../ chains with @ - if you're aware of Theo from T3 then you'll recognise this pattern.

const path = require("path");

/** @type {import('next').NextConfig} */
const nextConfig = {
    reactStrictMode: true,
    swcMinify: true,
    webpack(config, { webpack }) {
        config.resolve.alias["@"] = path.resolve("./src");

        return config;
    },
};

module.exports = nextConfig;

At the moment I am trying to replicate this alias in Bun and when reading the documentation it isn't clear to me how to set this up in bunfig.toml, which at the moment looks like this:

framework = "next"

How can I achieve this alias?

faint ridge
#

You can use tsconfig.json "paths"

indigo sun
faint ridge
#

you can do jsconfig.json

indigo sun
#

Will look into, thank you kindly Jarred! 💞

willow hare
#

Did you ever find a solution to this @indigo sun ? I'm looking to do the same thing

indigo sun