Skip to content

updating Encore docs for 1.0 #14895

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
merged 1 commit into from
Feb 5, 2021
Merged

Conversation

weaverryan
Copy link
Member

Hi!

I do an entire, quick read-through of the docs and updated for 1.0 (and modernized a few spots - like var -> const - symfony/recipes#886

Cheers!

@weaverryan weaverryan force-pushed the update-for-encore1.0 branch 2 times, most recently from c4613b1 to c67c0d7 Compare January 28, 2021 16:37
Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

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

Hi Ryan,

I was planning to open a new PR for documenting changes from symfony/webpack-encore#893, but since you already opened a PR maybe I can do some suggestions here:

Thanks! :)

.. code-block:: diff
Hot module replacement is a superpower of the ``dev-server`` where styles and
(in some cases) JavaScript can automatically update without needing to reload
your page. HMR works automatically with CSS (as long as you're using the
Copy link
Member

@Kocal Kocal Jan 28, 2021

Choose a reason for hiding this comment

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

Oh! Does it mean we don't have to use Encore.disableCssExtraction(Encore.isDevServer()) anymore? Nice! :D

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't read about this specifically, but when I tested it on my project earlier (which DOES always use CSS extraction), it totally worked!

Copy link
Member

Choose a reason for hiding this comment

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

I confirm I didn't had to use Encore.disableCssExtraction(Encore.isDevServer()) on my project too!

@weaverryan
Copy link
Member Author

Thanks @Kocal! I really appreciate it - good catches.

@weaverryan weaverryan force-pushed the update-for-encore1.0 branch from 344d73b to f471149 Compare January 29, 2021 01:07
@Kocal
Copy link
Member

Kocal commented Jan 29, 2021

Hi!

I'm sorry, I was wrong for the option --firewall false, it does not work as expected.
Since https://github.com/symfony/webpack-encore/releases/tag/v1.0.2 has been released, I'm now able to play with the dev-server and I faced the Invalid Host Header.

However, using Encore.configureDevServer() works fine but that's not ideal:

Encore.configureDevServer(option => {
    option.firewall = false;
});

@weaverryan
Copy link
Member Author

What do you think about the last commit @Kocal? I'm showing options.firewall = false. That section about CORS had previously mentioned using ``--port`, but that seemed unrelated / unnecessary to me.

@Kocal
Copy link
Member

Kocal commented Jan 31, 2021

That's great 👍

I don't think this will be an issue for not specifying --port option, usually VM opens all ports (I've never had to configure this flag).

@@ -11,7 +11,7 @@ Using React? First add some dependencies with Yarn:
.. code-block:: terminal

$ yarn add @babel/preset-react --dev
$ yarn add react react-dom prop-types
$ yarn add react react-dom prop-types --dev
Copy link
Member

Choose a reason for hiding this comment

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

That's funny because we have the same contribution last week (#14867)

Are we sure about this modification?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought we did EVERYTHING as --dev because none of this is actually read at runtime. This allows for the edge case of an application where you have Encore + some Node app that you do run on production at runtime..

But, I'm going to remove it so it doesn't get blocked.

Copy link
Member

Choose a reason for hiding this comment

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

As you wish!

@weaverryan
Copy link
Member Author

Ok, should be good again!

@@ -61,7 +61,6 @@ Optimizing
* :doc:`Using a CDN </frontend/encore/cdn>`
* :doc:`/frontend/encore/code-splitting`
* :doc:`/frontend/encore/split-chunks`
* :doc:`Creating a "Shared" entry for re-used modules </frontend/encore/shared-entry>`
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we redirect this?

Comment on lines -112 to -113
Beware that `it's not recommended to disable host checking`_ in general, but
here it's required to solve the CORS issue.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that warning should be kept since it is still not recommended to disable those checks entirely (you can usually make it work by explicitly whitelisting hosts).

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it here: #14929

@weaverryan weaverryan force-pushed the update-for-encore1.0 branch from e8c902c to a85f968 Compare February 5, 2021 00:25
@weaverryan weaverryan merged commit 8308294 into symfony:5.2 Feb 5, 2021
@weaverryan weaverryan deleted the update-for-encore1.0 branch February 5, 2021 00:30
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Feb 5, 2021
…verryan)

This PR was merged into the 5.2 branch.

Discussion
----------

Encore dev-server: re-add host check warning

See: symfony#14895 (comment)

Commits
-------

47d7639 re-adding warning about host check
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.

6 participants