Skip to content

Commit

Permalink
inject hotEntry for browserslist target
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxsan committed Nov 17, 2020
1 parent 19b793f commit 4f7f58c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/utils/addEntries.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ function addEntries(config, options, server) {
[].concat(config).forEach((config) => {
/** @type {Boolean} */
const webTarget = [
'browserslist',
'web',
'webworker',
'electron-renderer',
Expand Down
5 changes: 3 additions & 2 deletions test/server/utils/addEntries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,12 @@ describe('addEntries util', () => {
it('should only prepends devServer entry points to web targets by default', () => {
const webpackOptions = [
Object.assign({}, config),
Object.assign({ target: 'browserslist' }, config),
Object.assign({ target: 'web' }, config),
Object.assign({ target: 'webworker' }, config),
Object.assign({ target: 'electron-renderer' }, config),
Object.assign({ target: 'node-webkit' }, config),
Object.assign({ target: 'node' }, config) /* index:5 */,
Object.assign({ target: 'node' }, config) /* index:6 */,
];

const devServerOptions = {};
Expand All @@ -322,7 +323,7 @@ describe('addEntries util', () => {

// eslint-disable-next-line no-shadow
webpackOptions.forEach((webpackOptions, index) => {
const expectInline = index !== 5; /* all but the node target */
const expectInline = index !== 6; /* all but the node target */

expect(webpackOptions.entry.length).toEqual(expectInline ? 2 : 1);

Expand Down

0 comments on commit 4f7f58c

Please sign in to comment.