Skip to content

Adding recipe for symfony/webpack-encore-bundle #458

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

Merged
3 commits merged into from
Nov 5, 2018
Merged

Adding recipe for symfony/webpack-encore-bundle #458

3 commits merged into from
Nov 5, 2018

Conversation

weaverryan
Copy link
Member

@weaverryan weaverryan commented Sep 9, 2018

Q A
License MIT

Hi guys!

This is for the new bundle - https://github.com/symfony/webpack-encore-bundle.

This would replace the webpack-encore-pack recipe. Well, we won't delete that, but the idea would be that we would now install this bundle, not the pack.

Cheers!

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Good!

Ping me when you've tagged 1.0

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

webpack_encore:
# The path where Encore is building the assets.
# This should match Encore.setOutputPath() in webpack.config.js.
output_path: '%kernel.public_dir%/build'
Copy link
Contributor

Choose a reason for hiding this comment

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

What about using two separate build directories per dev/prod env? It useful when you should testing in both modes in same time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think that it's really common to run dev & prod at the same time in the same environment...

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

@weaverryan weaverryan changed the title [WIP] Adding recipe for symfony/webpack-encore-bundle Adding recipe for symfony/webpack-encore-bundle Nov 5, 2018
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

@weaverryan
Copy link
Member Author

weaverryan commented Nov 5, 2018

This is ready for review - the bundle 1.0 has been released.

The biggest change is moving the recipe from webpack-encore-pack to webpack-encore-bundle. The pack was originally needed because there was no PHP package we could attach the recipe to. But, the bundle has the same dependencies as the pack (symfony/assets) and so we can fully use it.

Update: re-added WIP so I can test what happens if I remove the pack.

Thanks!

@weaverryan weaverryan changed the title Adding recipe for symfony/webpack-encore-bundle [WIP] Adding recipe for symfony/webpack-encore-bundle Nov 5, 2018
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request does not pass validation.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

@weaverryan weaverryan changed the title [WIP] Adding recipe for symfony/webpack-encore-bundle Adding recipe for symfony/webpack-encore-bundle Nov 5, 2018
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Pull request passes validation.

@weaverryan
Copy link
Member Author

This is ready to go. I just tested that if you remove symfony/webpack-encore-pack, it will not remove all your existing files, because it (apparently) uses the most up-to-date recipe version, which contains no files to remove.

Copy link
Member

@Nyholm Nyholm left a comment

Choose a reason for hiding this comment

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

Thank you.

@ghost ghost merged commit 8a4e555 into symfony:master Nov 5, 2018
ghost pushed a commit that referenced this pull request Nov 5, 2018
@weaverryan weaverryan deleted the webpack-encore-bundle branch November 5, 2018 18:47
weaverryan added a commit to symfony/symfony-docs that referenced this pull request Nov 5, 2018
This PR was squashed before being merged into the 3.4 branch (closes #10322).

Discussion
----------

[WCM] Encore updates for Webpack 4

Phew! The next (unreleased) version of Webpack Encore (will be 0.21.0) that supports Webpack 4 will contain a few minor changes, that have major implications on the documentation. Ultimately, I think the experience will be easier for users :). The 3 big changes are:

1) In all cases, people should use the new WebpackEncoreBundle and its 2 new Twig functions - `encore_entry_script_tags()` and `encore_entry_link_tags()` to render their `script` and `link` tags.

2) In earlier versions, an extra `manifest.js` file was output when using `createdSharedEntry()`. But now, a new `runtime.js` file is *always* output. But, because of the `encore_entry_script_tags()` shortcut... that's just rendered for you automatically.

3) `createSharedEntry()` is no longer hipster ;). This is from changes in Webpack. A newer, and better "split chunks" feature replaces it... which (other than changing how existing users think), is much simpler. Basically, the user does nothing... except call `encore_entry_script_tags()`. But, when this feature is enabled, the final `.js` and `.css` files may be split into multiple files. And so, the `encore_entry_script_tags()` (and also the link version) may render *multiple* script tags. This all happens automatically.

TODO: Wait for the bundle to be tagged, then test the new recipe (symfony/recipes#458) and code through some of the docs to catch any mistakes (due to so many changes).

**Merging into 4.1 TODOS**
* update `web/` to `public/`

Cheers!

Commits
-------

12ca7d9 adding a small entry about ajax code splitting
165432f fixing build errors
bf649ab Documenting copyFiles() and a few small things
6833bb6 finishing read-through
c2b36a2 more work on encore
53f9ffe Adding docs for runtime.js and fixed a few other things
62f322e documenting the new split chunks and Twig helper functions for Encore
This pull request was closed.
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

Successfully merging this pull request may close these issues.

5 participants