You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When doing the production build, I wanted to manually control the JS chunks generated by default on the client side. I added the rollup output config options in my project's vite.config file and expected that the client build will output JS chunks manually as I wanted them to. But these config were completely ignored by the remix plugin during the build time.
I inspected further inside the remix repo and found that the plugin.ts file isn't including the custom config I wrote when calling the vite runtime. I want to reduce the number of JS files in production build for performance reason, how can I do it? Is there any plan to support this?
My vite config
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
server: {
port: Number(process.env.PORT || 3000),
hmr: hmrConfig,
fs: {
// See https://vitejs.dev/config/server-options.html#server-fs-allow for more information
allow: ["app", "node_modules"],
},
},
plugins: [
remix({
ignoredRouteFiles: ["**/.*"],
}),
tsconfigPaths(),
],
build: {
sourcemap: true, // Source map generation must be turned on
emptyOutDir: true,
assetsInlineLimit: "7168",
rollupOptions: {
output: {
entryFileNames: "[name]-[hash].js",
chunkFileNames: "chunks/[name]-[hash].js",
assetFileNames: "assets/[name]-[hash][extname]",
sanitizeFileName: true,
manualChunks: (id, { getModuleIds, getModuleInfo }) => {
// my custom chunk logic here
},
},
},
}
})
rabbykhairul
changed the title
Custom Rollup option for manual js chunks passed to vite config file isn't working
Custom Rollup option for manual JS chunk output passed to the Vite config file isn't working
Dec 1, 2024
If you do then it is working and it's more about the nuances when dealing with manualChunks, which is hard to troubleshoot without seeing your custom logic. But, you can try a simple example on one dependency and examine the built files:
Reproduction
When doing the production build, I wanted to manually control the JS chunks generated by default on the client side. I added the
rollup
output config options in my project'svite.config
file and expected that the client build will output JS chunks manually as I wanted them to. But these config were completely ignored by theremix
plugin during the build time.I inspected further inside the
remix
repo and found that theplugin.ts
file isn't including the custom config I wrote when calling the vite runtime. I want to reduce the number of JS files in production build for performance reason, how can I do it? Is there any plan to support this?My vite config
System Info
Used Package Manager
npm
Expected Behavior
Should output custom JS chunks on the client build as I've put custom
rollup
options in thevite
config file.Actual Behavior
Remix build is outputting chunks as usual and ignoring the custom config options.
The text was updated successfully, but these errors were encountered: