Skip to content

Support webpack 4 only #53

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 8, 2020
Merged

Support webpack 4 only #53

merged 1 commit into from
Jan 8, 2020

Conversation

melck
Copy link
Contributor

@melck melck commented Dec 17, 2019

Rewrite of plugin into es6 syntax.

Handle splitChunks options of Webpack 4.

BREAKING CHANGE: Drop support for Webpack version < 4

Related to #52

BREAKING CHANGE: Drop support for Webpack version < 4
@melck melck changed the title WIP feature: Support webpack 4 only Support webpack 4 only Jan 2, 2020
@melck
Copy link
Contributor Author

melck commented Jan 2, 2020

@owais I have tested my work, what do you think about this changes ?

@owais
Copy link
Collaborator

owais commented Jan 2, 2020

Thanks. Code looks good. Does this change the output format of the stats file in any way? Can you describe that in case.

Since we are dropping support, this is a nice opportunity to make any changes to the stats file schema so more use cases can be accommodated.

Generally I'd like to us to take a direction to make the stats file less specific to webpack. It should just contains references to assets that a webserver can later retrieve. If we are able to do that, we can then further protect non-JS web servers from the constant change in JS land but this needs further discussion and probably in a different place.

@melck
Copy link
Contributor Author

melck commented Jan 4, 2020

The output format change a little but no breaking change. For exemple with full options, for two app we have :

{
    "status": "done",
     "publicPath": "http://localhost:3000/assets/",
     "startTime": 1578131712,
     "endTime": 1578131912,
    "chunks": {
            "app1": [
              {
                "name": "vendors-zeazeazae62165416.js",
                "publicPath": "http://localhost:3000/assets/js/vendors-zeazeazae62165416.js",
                "path": "http://localhost:3000/assets/js/vendors-zeazeazae62165416.js",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              },
              {
                "name": "commons-gfhrtyhrh45665.js",
                "publicPath": "http://localhost:3000/assets/js/commons-gfhrtyhrh45665.js",
                "path": "http://localhost:3000/assets/js/commons-gfhrtyhrh45665.js",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              },
              {
                "name": "app1-tyujtyjgh6546879.css",
                "publicPath": "http://localhost:3000/assets/js/app1-tyujtyjgh6546879.css",
                "path": "http://localhost:3000/assets/js/app1-tyujtyjgh6546879.css",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              },
              {
                "name": "app1-zeazeazae62165416.js",
                "publicPath": "http://localhost:3000/assets/js/app1-zeazeazae62165416.js",
                "path": "http://localhost:3000/assets/js/app1-zeazeazae62165416.js",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              }
            ],
            "app2": [
              {
                "name": "vendors-zeazeazae62165416.js",
                "publicPath": "http://localhost:3000/assets/js/vendors-zeazeazae62165416.js",
                "path": "http://localhost:3000/assets/js/vendors-zeazeazae62165416.js",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              },
              {
                "name": "commons-gfhrtyhrh45665.js",
                "publicPath": "http://localhost:3000/assets/js/commons-gfhrtyhrh45665.js",
                "path": "http://localhost:3000/assets/js/commons-gfhrtyhrh45665.js",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              },
              {
                "name": "app2-erzterte46544.css",
                "publicPath": "http://localhost:3000/assets/js/app2-erzterte46544.css",
                "path": "http://localhost:3000/assets/js/app2-erzterte46544.css",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              },
              {
                "name": "app2-dfgdfgs54645.js",
                "publicPath": "http://localhost:3000/assets/js/app2-dfgdfgs54645.js",
                "path": "http://localhost:3000/assets/js/app2-dfgdfgs54645.js",
                "integrity": "sha256-SHA256 sha384-SHA384 sha512-SHA512"
              }
            ]
          }
    }
}

It will show only entrypoint chunkGroup, not child chunk load on demand.

@owais
Copy link
Collaborator

owais commented Jan 4, 2020

Should path a be file-system path instead of a URL?

@melck
Copy link
Contributor Author

melck commented Jan 5, 2020

Yes it was a mistake when copy / paste.

@owais
Copy link
Collaborator

owais commented Jan 8, 2020

Sounds good. We'll also need to add test cases to django-webpack-loader for webpack4 to ensure nothing breaks there.

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

Successfully merging this pull request may close these issues.

2 participants