Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Various Encore updates #8084

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 10 commits into from
Jun 26, 2017
Merged

Various Encore updates #8084

merged 10 commits into from
Jun 26, 2017

Conversation

@weaverryan weaverryan changed the title [WIP] Various Encore updates Various Encore updates Jun 25, 2017
Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

Very nice changes and perfectly explained. Thanks @weaverryan.


Quite simply, Encore generates the Webpack configuration that's used in your
``webpack.config.js`` file. Encore doesn't support adding all of Webpack's
`configuration options`_, because many can be easy added on your own.
Copy link
Member

Choose a reason for hiding this comment

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

easy -> easily ?

`configuration options`_, because many can be easy added on your own.

For example, suppose you need to set `Webpack's watchOptions`_ setting. To do that,
modify the config it after fetching the it from Encore:
Copy link
Member

Choose a reason for hiding this comment

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

the config it after -> the config after

// config.resolve.alias.local = path.resolve(__dirname, './resources/src');
// config.resolve.extensions.push('json');


Copy link
Member

Choose a reason for hiding this comment

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

Extra blank line here

// export the final config
module.exports = config;

But be careful not to accidentally override any config from Encore:
Copy link
Member

Choose a reason for hiding this comment

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

This is easy to say, but hard to accomplish :) I guess most of configs are handled internally by Webpack so, how can I know if I'm unawarely overriding a setting?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed, this is tricky. For example, suppose today Encore doesn't ship with any config.resolve.alias key. But then on the next release, we add config.resolve.alias.foo = 'bar'. If you were already setting config.resolve.alias to a value manually, you're now overriding our config. The best we can do is warn the users here, and document these well in releases (to me, this is a soft BC break - not something to be taken lightly).

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe link to one of the deepExtend implementations (like the one from underscore.js) and use it instead? So that config is merged, if appropriate?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's probably a good idea - would you be willing to open a small PR for that?


.. tip::

The ``global`` variable is a special way of setting things pn the ``window``
Copy link
Member

Choose a reason for hiding this comment

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

pn -> in

@weaverryan weaverryan merged commit 15e816e into symfony:3.3 Jun 26, 2017
weaverryan added a commit that referenced this pull request Jun 26, 2017
This PR was merged into the 3.3 branch.

Discussion
----------

Various Encore updates

Closes:
* #8053
* #8067
* #8069
* #8071
* #8070
* #8072

Replaces #8083

Commits
-------

15e816e Tweaks thanks to Javier
f8461d3 adding anotehr faq for old packages without a main script
f5c22a6 minor rewording
a0982ec [Encore] Adding more FAQs for #8072
807b83f [Encore] Documenting addPlugin - see #8070
a099bff Documenting (better) how to expose global variables - see #8071
8b0a22a [Encore] Adding docs about deploying to a subdirectory - see #8069
62dd63e Adding docs about adding custom config - see #8067
0ff1c3c Add missing link to handlebars-loader
3d9905e Add docs for custom loaders
@weaverryan weaverryan deleted the encore-various-tweaks branch June 26, 2017 19:03
// ...

// GOOD - this modifies the config.resolve.extensions array
// config.resolve.extensions.push('json');
Copy link
Member

Choose a reason for hiding this comment

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

I would uncomment the code line. It would be more readable as it will be syntax-highlighted (same below)

// ...
.addLoader({
test: /\.handlebars$/,
loader: 'handlebars-loader',
Copy link
Member

Choose a reason for hiding this comment

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

indentation looks weird here

.addLoader({
test: /\.handlebars$/,
loader: 'handlebars-loader',
query: {
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 options, not query, as we are using Webpack 2, not Webpack 1


+ // this is now needed so that your manifest.json keys are still `build/foo.js`
+ // i.e. you won't need to change anything in your Symfony app
+ config.setManifestKeyPrefix('build')
Copy link
Member

Choose a reason for hiding this comment

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

config should not be here, as you add this in a chain call (and there is no config variable)

weaverryan added a commit that referenced this pull request Jun 28, 2017
@weaverryan
Copy link
Member Author

Thanks @stof - I made the fixes in sha: 57a7a12

weaverryan added a commit that referenced this pull request Jun 28, 2017
* 3.4:
  Fixes for #8084 thanks to Stof
  Tweaks thanks to Javier
  Use Twig's namespaced paths
  adding anotehr faq for old packages without a main script
  minor rewording
  [Encore] Adding more FAQs for #8072
  [Encore] Documenting addPlugin - see #8070
  Documenting (better) how to expose global variables - see #8071
  [Encore] Adding docs about deploying to a subdirectory - see #8069
  Adding docs about adding custom config - see #8067
  Add missing link to handlebars-loader
  Add docs for custom loaders
  [#8004] some minor tweaks
  document new framework.assets.json_manifest_path option
  Minor reword
  Clearify setup of basic auth for test environment
  Update workflow.rst
  rearrange how workflow events are presented
  adding note about extracting CSS
  Adding note about browserslist config
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.