-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Various Encore updates #8084
Conversation
There was a problem hiding this 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.
frontend/encore/advanced-config.rst
Outdated
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easy -> easily ?
frontend/encore/advanced-config.rst
Outdated
`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: |
There was a problem hiding this comment.
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
frontend/encore/advanced-config.rst
Outdated
// config.resolve.alias.local = path.resolve(__dirname, './resources/src'); | ||
// config.resolve.extensions.push('json'); | ||
|
||
|
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
frontend/encore/legacy-apps.rst
Outdated
|
||
.. tip:: | ||
|
||
The ``global`` variable is a special way of setting things pn the ``window`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pn
-> in
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
// ... | ||
|
||
// GOOD - this modifies the config.resolve.extensions array | ||
// config.resolve.extensions.push('json'); |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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)
* 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
Closes:
Replaces #8083