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

Option to automatically clean the output directory of the adapter #2386

Closed
chblack42 opened this issue Sep 8, 2021 · 1 comment · Fixed by #2388
Closed

Option to automatically clean the output directory of the adapter #2386

chblack42 opened this issue Sep 8, 2021 · 1 comment · Fixed by #2388

Comments

@chblack42
Copy link

Describe the problem

When building, npm run build, with the node adapter I noticed old files are still in the adapter's output directory. In the attached image you can see multiple versions of each __layout, index and error files in the ll-app/build folder's subdirectories. In addition, an old favicon_old.svg is in there.

Not sure if this is specific to just node or all the adapters.

image

Describe the proposed solution

It would be nice if the adapter had an option to always clean the output directory. It would be even better if the default behavior was to clean on every run. This step is likely going to be part of any production build/pipeline so being 100% that all steps along the way are clean would be great!

I know this is a really simple thing for anyone to script up on their own, but intuitively (and lazily!) I've come to expect build and export directories to be the cleanest version of themselves automatically. If this project wasn't in such I simple state right now I'm not sure when I would have noticed old assets being in there. If you decided against adding this feature, I ask that it at least gets mentioned in the documentation of the svelte-kit build command line option!

Alternatives considered

The alternative is just to clear/delete the adapter's output directory prior to ever running npm run build.

Importance

would make my life easier

Additional Information

My svelte.config.js files looks like this

import preprocess from 'svelte-preprocess';
import node from '@sveltejs/adapter-node';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	// Consult https://github.com/sveltejs/svelte-preprocess
	// for more information about preprocessors
	preprocess: preprocess(),

	kit: {
		// hydrate the <div id="svelte"> element in src/app.html
		adapter: node(),
		target: '#svelte'
	}
};

export default config;
@ignatiusmb
Copy link
Member

Thanks for opening an issue. Yes, this is specific to adapter-node as it is the only adapter left that hasn't clear out the build output prior to adapting, might just be an oversight.

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

Successfully merging a pull request may close this issue.

2 participants