[go: up one dir, main page]

Skip to content

Building / Deploying for relative paths (subdirectory) #2534

Closed Answered by nskydb
nskydb asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

I solved it like this:

import { defineConfig, loadEnv } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
import { pluginSvgr } from "@rsbuild/plugin-svgr";
import { pluginSass } from "@rsbuild/plugin-sass";

const { publicVars } = loadEnv({ prefixes: ["REACT_APP_"] });

export default defineConfig({
  plugins: [
    pluginReact(),
    pluginSass(),
    pluginSvgr({ svgrOptions: { svgo: false }, mixedImport: true }),
  ],
  html: {
    template: "./public/index.html",
  },
  output: {
    assetPrefix: "/mysubdir/",
    distPath: {
      root: "build/",
      js: "mysubdir/static/js",
      jsAsync: "mysubdir/static/js/async",
      css: "mysubdir/static/css",
…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@RBilly
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@chenjiahan
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by chenjiahan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants