swashata / wp-webpack-script

💥🔥📦👩‍💻 An easy to use, pre configured, hackable webpack setup & development server for WordPress themes and plugins.
https://wpack.io
MIT License
407 stars 57 forks source link

@wpackio/entrypoint 6 and wpackio/enqueue 3.1.0 are incompatible #1222

Closed robsonsobral closed 3 years ago

robsonsobral commented 3 years ago

It took me some time, but I found the issue driving me crazy all day.

wpackio/enqueue looks for assets property within endpoint.

$enqueue =
    isset( $manifest['wpackioEp'][ $entryPoint ]['assets'] )
        ? $manifest['wpackioEp'][ $entryPoint ]['assets']
        : false;

But @wpackio/entrypoint creates a different structure:

  "wpackioEp": {
    "main": {
      "js": [
        "app/runtime.js",
        "app/vendors~main.js",
        "app/main.js"
      ],

This is a total showstopper.

robsonsobral commented 3 years ago

I can fix it, @swashata . Just tell which path to take. To change the manifest structure? Or to make the PHP retrocompatible?

swashata commented 3 years ago

Hi @robsonsobral,

With the v6 update of @wpackio/scripts, I am using webpack-assets-manifest 4.0.6 which outputs the manifest like

  "wpackioEp": {
    "main": {
      "assets": {
        "js": [
          "app/runtime.js",
          "app/vendors~main.js",
          "app/main.js"
        ],
      }

I think for some reason, webpack-assets-manifest is stuck at a previous version in your case. Do check your package.json or yarn resolution. Maybe remove the lock file and node_modules and reinstall?

robsonsobral commented 3 years ago

You're right, @swashata ! I'm so sorry for bothering you.

swashata commented 3 years ago

No problem at all. And thank you for the pr on docs 👍