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

Update Encore and tweak some of its settings #960

Merged
merged 1 commit into from Apr 6, 2019

Conversation

Lyrkan
Copy link
Contributor

@Lyrkan Lyrkan commented Mar 29, 2019

This PR:

  • Updates the version of Encore to ^0.26
  • Updates the related bundle to ^1.4
  • Fixes the imported font paths that were not working anymore due to the recent resolve-url-loader update
  • Enables integrity hashes by default
  • Adds core-js@3 and configures Babel properly so polyfills are automatically added to the resulting build
  • Disables file versioning when not in production mode (which prevented from using the dev-server)

@Lyrkan
Copy link
Contributor Author

Lyrkan commented Mar 29, 2019

Failing tests should be fixed by #955.

@javiereguiluz
Copy link
Member

Thanks a lot for working on all this! I tried to merge this and solve the conflicts myself, but I couldn't. Could you please solve the conflicts? Thanks.

@Lyrkan
Copy link
Contributor Author

Lyrkan commented Apr 4, 2019

It should be ok now :)

.addEntry('app', './assets/js/app.js')
.addEntry('login', './assets/js/login.js')
.addEntry('admin', './assets/js/admin.js')
.addEntry('search', './assets/js/search.js')
.splitEntryChunks()
.enableSingleRuntimeChunk()
.enableIntegrityHashes()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be enabled only in production. In dev, it would cause issue when using the watcher, as I'm not sure the updated entrypoints.json gets dumped again by the watcher (and then, that would make it an integrity violation)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually works fine in both --watch and dev-server mode.

For the first one, the entrypoints.json does get dumped again with updated hashes, and since --watch implies a browser refresh the integrity attribute gets updated accordingly.

Here is an example with some additional logs after changing the app.js file:

image

And with the dev-server enabled the integrity hashes are not computed at all since the files aren't dumped. This results in an empty integrity object in the entrypoints.json and no integrity attributes in the generated tags:

{
  "entrypoints": {
    // (...)
    "search": {
      "js": [
        "http://localhost:8080/build/runtime.js",
        "http://localhost:8080/build/vendors~admin~app~login~search.js",
        "http://localhost:8080/build/vendors~admin~app~search.js",
        "http://localhost:8080/build/vendors~app~search.js",
        "http://localhost:8080/build/vendors~search.js",
        "http://localhost:8080/build/search.js"
      ]
    }
  },
  "integrity": {}
}

@javiereguiluz
Copy link
Member

Thank you Vincent.

@javiereguiluz javiereguiluz merged commit 8ee0df5 into symfony:master Apr 6, 2019
javiereguiluz added a commit that referenced this pull request Apr 6, 2019
This PR was merged into the master branch.

Discussion
----------

Update Encore and tweak some of its settings

This PR:

* Updates the version of Encore to `^0.26`
* Updates the related bundle to `^1.4`
* Fixes the imported font paths that were not working anymore due to [the recent `resolve-url-loader` update](symfony/webpack-encore#540)
* Enables integrity hashes by default
* Adds `core-js@3` and configures Babel properly so polyfills are automatically added to the resulting build
* Disables file versioning when not in production mode (which prevented from using the dev-server)

Commits
-------

8ee0df5 Update Encore and tweak some of its settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants