2

I need to output multiple .js files based on locale for my project. Is this possible? Would I have to have multiple vite.config.js files and build them separately?

To bundle I use npm run build which bundles into a dist folder.

If I could build separately, my thought is that each file would have something like this, but the input path would change, and ouput file name would too per country/locale.

ex file 1

rollupOptions: {
            input: {
                index: "./src/en_US/sitemap.js",

            },
            output: {
                entryFileNames: "sitemap-en-us.js",
            },
        },

ex file 2

rollupOptions: {
            input: {
                index: "./src/en_CA/file.js",

            },
            output: {
                entryFileNames: "file-en-ca.js",
            },
        },

but how would i configure having 2 vite.config.js files?

OR, can I set up having mulitple inputs with multiple outputs? Can I have index1, index2 with multiple entry points assigned to each input?

1

1 Answer 1

-2

You can create 2 vite config files, then run vite build -c us.config.js && vite build -c ca.config.js

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.