wp-webpack-script icon indicating copy to clipboard operation
wp-webpack-script copied to clipboard

Dist folder is empty when running start script

Open primozw opened this issue 5 years ago • 14 comments

Hi! First, thanks for the great framework. I would just like to ask you for a little help. I'm having trouble with configurations of the framework. I have defined the entry points in wpackio.project.js and use the wpackio/enqueue object to include all the assets in php file. When I run build script, the assets are bundle successfully inside dist folder and the wpackio/enqueue give me the right path to them. But when I run the start script the dist folder remains empty (only manifest.json file is inside), so the assets can not be included to wp. Thanks for the help!

primozw avatar Jan 31 '20 10:01 primozw

Hi there. It looks like really cool workflow tool. Thank you! However I have the same problem, only manifest is created when I run start script.

deeppresentation avatar Jan 31 '20 11:01 deeppresentation

Hi,

That's the intended behaviour. Files are served from memory when hit from right URL, that's why the PHP library is there. When you build though, files are written to disk.

swashata avatar Jan 31 '20 18:01 swashata

Thanks for the help. When I run the build script I get the correct path from enqueue method of \WPackio\Enqueue: http://localhost:8888/[sub-filder]/wp-content/plugins/[plugin]/dist/assets/[file-name] and the file is there. But when I run the start script I get the path: //192.168.64.101:3000/[sub-filder]/wp-content/plugins/[plugin]/dist/assets/[file-name] and I get ERR_ABORTED 404 (Not Found) in browser. Do I need to add some additional settings or am I doing something wrong? Thanks, once again.

primozw avatar Feb 01 '20 16:02 primozw

Hi, thanx for fast answer. I made a test to install wp directly to root of my local server (not use subfolder for wordpress installation), and then everything works great. So I guess problem is subfolder. (

even when I set proxy: http://localhost/{{sub-folder}} distPublicPath: {{sub-folder}}/wp-content/{{plugins|themes}}/{{slug}}/{{outputPath}}/

I see in doc ... Right now, we recommend having a Root WordPress installation (not sub-folder). If you have sub-folder installation, then put the whole URL as proxy like http://localhost/wp-plugin

So I guess it is in process.

Thanks for great tool and looking forward to sub-folder fix :)

deeppresentation avatar Feb 01 '20 22:02 deeppresentation

Hi,

That is correct. If you have WordPress installed in sub-directory, then the proxy should also be the URL pointing to the WordPress instance.

distPublicPath is relative to the root (regardless of what you have in proxy, meaning if you have http://localhost/my-wp/ and distPublicPath set to hello-kitty/wp-content/plugin/my-plugin/dist/, the hot client will look at the path http://localhost/hello-kitty/.... I hope this explains.

swashata avatar Feb 03 '20 12:02 swashata

Hi, Yes, but currently this approach:

proxy: http://localhost/{{sub-folder}} distPublicPath: {{sub-folder}}/wp-content/{{plugins|themes}}/{{slug}}/{{outputPath}}/

doesn't work for me. I get ERR_ABORTED 404 for processed assets. image

So I just installed wordpress into root of my server temporarily as a workaround, but it would be great if subfolder installation works as well

deeppresentation avatar Feb 03 '20 14:02 deeppresentation

I have the same issue, my Wordpress instance is also in a sub folder.

module.exports = {
	proxy: 'http://localhost/<wp-folder>/',
	distPublicPath: '<wp-folder>/wp-content/themes/<my-theme>/dist/',
};

LeoSeyers avatar Apr 12 '20 13:04 LeoSeyers

Hello,

Please try this

module.exports = {
	proxy: 'http://localhost/<wp-folder>/',
	distPublicPath: '/wp-content/themes/<my-theme>/dist/',
};

Also kindly report back to me whether this works or not.

swashata avatar Apr 27 '20 16:04 swashata

Hello,

Please try this

module.exports = {
	proxy: 'http://localhost/<wp-folder>/',
	distPublicPath: '/wp-content/themes/<my-theme>/dist/',
};

Also kindly report back to me whether this works or not.

Sorry I missed your answer, I will have a look

LeoSeyers avatar Aug 08 '20 15:08 LeoSeyers

It doesn't work. I have the same issue. Please give me the correct answer for that

izundo-viennv avatar Oct 18 '20 11:10 izundo-viennv

Then try this

module.exports = {
	proxy: 'http://localhost/',
	distPublicPath: '/<wp-folder>/wp-content/themes/<my-theme>/dist/',
};

swashata avatar Oct 20 '20 08:10 swashata

Then try this

module.exports = {
	proxy: 'http://localhost/',
	distPublicPath: '/<wp-folder>/wp-content/themes/<my-theme>/dist/',
};

Thanks this worked for me

MitchJackson94 avatar Jan 14 '21 17:01 MitchJackson94

Hello,

Thank you for the confirmation. Would you be kind to add this to our documentation?

swashata avatar Jan 16 '21 07:01 swashata

so .. this does not seem to work for me. whatever i put in distPublicPath it does not change the path that gets loaded by wpack.io ...

koraysels avatar Feb 10 '21 19:02 koraysels