-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add Preact preset (with preact-compat support) #144
Conversation
index.js
Outdated
* @param {boolean} usePreactCompat | ||
* @returns {exports} | ||
*/ | ||
enablePreactPreset(usePreactCompat = false) { |
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 the only part I'm not sure about. When I saw your code examples, I assumed the true/false was turning the entire feature on/off (like some of our other enable()
methods). It's more verbose, but I'd prefer enablePreactPreset({preactCompat: true})
style (with our normal validating of any options passed).
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 definitely agree with you :)
355686d
to
c0cb4ea
Compare
Great work! Another excellent addition! :) |
This PR was squashed before being merged into the master branch (closes #152). Discussion ---------- Add various methods to configure default plugins This PR adds some methods to configure default plugins (closes #148, closes #87 and closes #15): * `Encore.configureDefinePlugin(callback)` * `Encore.configureExtractTextPlugin(callback)` * `Encore.configureFriendlyErrorsPlugin(callback)` * `Encore.configureLoaderOptionsPlugin(callback)` * `Encore.configureUglifyJsPlugin(callback)` Other changes: * Allows the `clean-webpack-plugin` to be configured using `Encore.cleanupOutputBeforeBuild(paths, callback)` * Fixed a small mistake in the `Encore.configureManifestPlugin()` jsdoc * Reorganized flags/callbacks in the constructor of `webpack.config.js` since it was starting to be a bit hard to read. I'm not sure about the way I splitted things though, let me know what you think about it. * Renamed `common-chunks.js` to `commons-chunks.js` since the name of the plugin is `CommonsChunkPlugin` @weaverryan: Not directly related but while doing all of that I noticed that `sassOptions` uses snake-case whereas I used camel-case in #144 for `enablePreactPreset()` and in #115 for `configureRuntimeEnvironment()`, should we do something about that? ***Edit 1:** Added `Encore.configureCleanWebpackPlugin()`* ***Edit 2:** Removed `Encore.configureCleanWebpackPlugin()` to use `Encore.cleanupOutputBeforeBuild(paths, callback)` arguments instead* Commits ------- 286787a Minor text changes f72614b Remove configureCleanWebpackPlugin and use cleanupOutputBeforeBuild arguments instead 90c8565 Add various methods to configure default plugins
This PR adds a
enablePreactPreset()
method to the public API.Basically it allows to use Preact (which is an alternative to react), optionally in conjunction with
preact-compat
(which makes it possible to use the same code you would have in a React app).It doesn't enable a babel preset per-se but it's still some kind of preset and it makes it consistent with the already existing
enableReactPreset()
method.The method takes as an argument an option object that allows to enable/disable the use of
preact-compat
:I also created the following project as a PoC and it seems to be working as intended:
preact-compat
preact-compat