Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output cannot set the specified directory for #109

Open
Jiguangjie opened this issue Sep 1, 2023 · 1 comment
Open

Output cannot set the specified directory for #109

Jiguangjie opened this issue Sep 1, 2023 · 1 comment

Comments

@Jiguangjie
Copy link

export default {
input: 'src/index.js',
output: [
{
file: 'dist/js/bundle.js',
format: 'esm'
}
],
plugins: [
scss({
output: 'dist/css/style.css',
})
]
};

@tylercollier
Copy link

tylercollier commented Dec 27, 2024

Hoping this is the right issue to jump in on. I can't figure out how to set the output directory. This plugin is putting generated assets in a subfolder of the dist folder named assets, which I don't want. I just want them in the dist dir.

export default {
    input: 'main.js',
    output: {
        format: 'iife',
        entryFileNames: 'bundle-[hash].js',
        dir: 'dist',
    },
    plugins: [
        scss({ name: 'bundle.css' }),
    ],
};

EDIT

Found it. Set assetFileNames in the output config section.

See: https://rollupjs.org/configuration-options/#output-assetfilenames

Here's an example:

export default {
    input: 'main.js',
    output: {
        format: 'iife',
        entryFileNames: 'bundle-[hash].js',
        assetFileNames: 'bundle-[hash][extname]',
        dir: 'dist',
    },
    plugins: [
        scss({ name: 'bundle.css' }),
    ],
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants