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

preact watch build hangs with CLI v3.0.0-rc.10 #11

Open
SolarLiner opened this issue Mar 14, 2020 · 3 comments
Open

preact watch build hangs with CLI v3.0.0-rc.10 #11

SolarLiner opened this issue Mar 14, 2020 · 3 comments

Comments

@SolarLiner
Copy link

This is due to the ImageminPlugin, which I think waits for images to be available in the build directory to optimize them. However with the watch command, no build dir is created, which makes the plugin indefinitely wait for files that will never arrive.

The solution is to only push the plugin into the webpack config in build mode.

A small, related detail with the plugin is that it's being hardcoded to looking inside build which may not be what the user set (depends on the --dest option).

@prateekbh
Copy link
Member

are you using the netlify plugin or are building a blog with netlify CMS?

@SolarLiner
Copy link
Author

Blog with Netlify CMS - the project was generated from their "one-click deploy" button on the docs

@prateekbh
Copy link
Member

A small, related detail with the plugin is that it's being hardcoded to looking inside build which may not be what the user set (depends on the --dest option).

This is a great catch.

Immediate fix: in your preact.config.js

module.exports = (config, env) => {
	const { production, ssr } = env;
	netlifyPlugin(config);
	production && !ssr && config.plugins.push(new ImageminPlugin({
		from: './build/assets/**',
		pngquant: {
			quality: '60'
		},
		plugins: [
			imageminMozjpeg({
				quality: 50,
				progressive: true
			})
		]
	}));
}

@prateekbh prateekbh reopened this Mar 17, 2020
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