Skip to content

Commit

Permalink
7.0.0-alpha.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
enact-bot committed Dec 6, 2024
2 parents ee6d25d + 6072798 commit 4824162
Show file tree
Hide file tree
Showing 5 changed files with 2,167 additions and 13,336 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 7.0.0-alpha.2 (December 6, 2024)

* `config-helper`: Added `replaceEntry` function to support multiple entries.
* `option-parser`: Added `entry` to support multiple entries.

# 7.0.0-alpha.1 (July 22, 2024)

* Updated the minimum version of Node to `18.18.0`.
Expand Down
22 changes: 22 additions & 0 deletions config-helper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const path = require('path');
const pkgRoot = require('./package-root');

let rootCache;
Expand Down Expand Up @@ -50,6 +51,27 @@ module.exports = {
this.replaceMain({entry: config.entry[opts.chunk || 'main']}, replacement, opts);
}
},
replaceEntry: function (config, replacement, opts = {}) {
let entries = replacement;
if (typeof replacement === 'string') {
try {
entries = JSON.parse(replacement);
} catch (e) {
entries = {main: replacement};
}
}
Object.keys(entries).forEach(key => (entries[key] = path.resolve(entries[key])));

const {main, ...restEntries} = entries;

if (main) this.replaceMain(config, main, opts);

if (Object.keys(restEntries).length !== 0) {
config.entry = {...config.entry, ...restEntries};
config.optimization.splitChunks = {...config.optimization.splitChunks, chunks: 'all'};
this.getPluginByName(config, 'MiniCssExtractPlugin').options.ignoreOrder = true;
}
},
polyfillFile: function ({entry} = {}) {
if (typeof entry === 'string') {
return isPolyfill(entry) && entry;
Expand Down
Loading

0 comments on commit 4824162

Please sign in to comment.