Skip to content

WRO-231: Merge feature/webpack5 to develop #95

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 9 commits into from
Apr 11, 2022
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
env: {
node: true
},
extends: ['enact', 'plugin:prettier/recommended', 'prettier/babel', 'prettier/react'],
extends: ['enact', 'plugin:prettier/recommended', 'prettier'],
plugins: ['import'],
rules: {
'import/no-unresolved': ['error', {commonjs: true, caseSensitive: true}],
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# unreleased

* Updated all dependencies, with webpack peer dependency restricted to >=5.0.0.
* Updated all webpack plugins to use WeakMap since `compilation.hooks` became frozen.
* `IlibPlugin`:
* Added `ILIB_ADDITIONAL_RESOURCES_PATH` to defined constants if provided.
* Added `publicPath` option to specify webpack public path.
* `PrerenderPlugin`: Added React18 support for `ReactDOMClient.hydrateRoot` instead of `ReactDOMClient.createRoot` for prerendered apps.

# 4.1.4 (February 18, 2022)

* `option-parser`: Added `additionalModulePaths` to specify paths to check when resolving modules.
Expand Down
4 changes: 3 additions & 1 deletion mixins/externals.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {

// Include plugin to hook into its events
const htmlPluginInstance = helper.getPluginByName(config, 'HtmlWebpackPlugin');
const webOSMetaPluginInstance = helper.getPluginByName(config, 'WebOSMetaPlugin');

const libraries = ['@enact', 'react', 'react-dom', 'ilib'];

Expand All @@ -32,7 +33,8 @@ module.exports = {
publicPath: opts['externals-public'] || opts.externalsPublic || opts.externals,
snapshot: opts.snapshot
},
htmlPlugin: htmlPluginInstance && htmlPluginInstance.constructor
htmlPlugin: htmlPluginInstance && htmlPluginInstance.constructor,
webOSMetaPlugin: webOSMetaPluginInstance && webOSMetaPluginInstance.constructor
})
);

Expand Down
7 changes: 5 additions & 2 deletions mixins/isomorphic.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {

// Include plugin to prerender the html into the index.html
const htmlPluginInstance = helper.getPluginByName(config, 'HtmlWebpackPlugin');
const webOSMetaPluginInstance = helper.getPluginByName(config, 'WebOSMetaPlugin');
config.plugins.push(
new PrerenderPlugin({
server: reactDOMServer,
Expand All @@ -49,7 +50,8 @@ module.exports = {
fontGenerator: app.fontGenerator,
externalStartup: app.externalStartup,
mapfile: opts.mapfile,
htmlPlugin: htmlPluginInstance && htmlPluginInstance.constructor
htmlPlugin: htmlPluginInstance && htmlPluginInstance.constructor,
webOSMetaPlugin: webOSMetaPluginInstance && webOSMetaPluginInstance.constructor
})
);

Expand All @@ -63,7 +65,8 @@ module.exports = {
// Include plugin to attempt generation of v8 snapshot binary if V8_MKSNAPSHOT env var is set
config.plugins.push(
new SnapshotPlugin({
target: 'main.js'
target: 'main.js',
webOSMetaPlugin: webOSMetaPluginInstance && webOSMetaPluginInstance.constructor
})
);
}
Expand Down
14 changes: 12 additions & 2 deletions mixins/verbose.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
const helper = require('../config-helper');
const VerboseLogPlugin = require('../plugins/VerboseLogPlugin');

module.exports = {
apply: function (config) {
return config.plugins.push(new VerboseLogPlugin());
apply: function (config, opts = {}) {
const prerenderInstance = helper.getPluginByName(config, 'PrerenderPlugin');
const snapshotPluginInstance = helper.getPluginByName(config, 'SnapshotPlugin');

return config.plugins.push(
new VerboseLogPlugin({
prerenderPlugin: prerenderInstance && prerenderInstance.constructor,
ProgressPlugin: opts.ProgressPlugin,
snapshotPlugin: snapshotPluginInstance && snapshotPluginInstance.constructor
})
);
}
};
Loading