Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webpack-cli): to void defaultEntry override the webpack config en…
…try (#1289) * fix(webpack-cli): to void defaultEntry override the webpack config entry if not pass the entry option through command line, webpack-cli would look for defaultEntry The action would override the entry in webpack config files ISSUES CLOSED: #1288 * chore(webpack-cli): remove the unused eslint comment and console statement * tests(jest): rename the tests for entry-with command and entry-with-config ISSUES CLOSED: #1288 * fix(bugs): to void defaultEntry override config entry To get the correct entry, the entry should use defaultEntry, config entry, command entry in order ISSUES CLOSED: #1288 * tests(entry): fix the word spelling of test case * fix(bugs): execute the basicGroup only once
- Loading branch information
Showing
9 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
entry: { | ||
index: '../a.js', | ||
}, | ||
output: { | ||
path: resolve(process.cwd(), 'binary'), | ||
filename: '[name].bundle.js', | ||
}, | ||
}; |
Empty file.
20 changes: 20 additions & 0 deletions
20
test/entry/config-entry/entry-with-command/entry-with-command.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
const { stat } = require('fs'); | ||
const { resolve } = require('path'); | ||
const { run, extractSummary } = require('../../../utils/test-utils'); | ||
|
||
describe('config entry and command entry all exist', () => { | ||
it('should use command entry if config command existed', done => { | ||
const { stdout } = run(__dirname, ['-c', '../1.js', './index.js'], false); | ||
const summary = extractSummary(stdout); | ||
const outputDir = 'entry-with-command/binary'; | ||
expect(summary['Output Directory']).toContain(outputDir); | ||
|
||
expect(stdout).toContain('./index.js'); | ||
stat(resolve(__dirname, './binary/main.bundle.js'), (err, stats) => { | ||
expect(err).toBeFalsy(); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
Empty file.
20 changes: 20 additions & 0 deletions
20
test/entry/config-entry/entry-with-config/entry-with-config.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
const { stat } = require('fs'); | ||
const { resolve } = require('path'); | ||
const { run, extractSummary } = require('../../../utils/test-utils'); | ||
|
||
describe('default entry and config entry all exist', () => { | ||
it('should use config entry if config entry existed', done => { | ||
const { stdout } = run(__dirname, ['-c', '../1.js'], false); | ||
const summary = extractSummary(stdout); | ||
const outputDir = 'entry-with-config/binary'; | ||
expect(summary['Output Directory']).toContain(outputDir); | ||
|
||
expect(stdout).toContain('./a.js'); | ||
stat(resolve(__dirname, './binary/index.bundle.js'), (err, stats) => { | ||
expect(err).toBeFalsy(); | ||
expect(stats.isFile()).toBe(true); | ||
done(); | ||
}); | ||
}); | ||
}); |
Empty file.