-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: empty entries #2920
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
fix: empty entries #2920
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,114 @@ | ||
'use strict'; | ||
|
||
const testBin = require('../helpers/test-bin'); | ||
const isWebpack5 = require('../helpers/isWebpack5'); | ||
|
||
describe('DevServer', () => { | ||
const webpack5Test = isWebpack5 ? it : it.skip; | ||
snitin315 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
it('should add devServer entry points to a single entry point', (done) => { | ||
testBin('--config ./test/fixtures/dev-server/default-config.js') | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('client/default/index.js?'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it('should add devServer entry points to a multi entry point object', (done) => { | ||
testBin( | ||
'--config ./test/fixtures/dev-server/multi-entry.js --stats=verbose' | ||
) | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('client/default/index.js?'); | ||
expect(output.stderr).toContain('foo.js'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
webpack5Test('should supports entry as descriptor', (done) => { | ||
testBin( | ||
'--config ./test/fixtures/entry-as-descriptor/webpack.config --stats detailed' | ||
) | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('foo.js'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it('should only prepends devServer entry points to "web" target', (done) => { | ||
testBin( | ||
'--config ./test/fixtures/dev-server/default-config.js --target web' | ||
) | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('client/default/index.js?'); | ||
expect(output.stderr).toContain('foo.js'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it('should not prepend devServer entry points to "node" target', (done) => { | ||
testBin( | ||
'--config ./test/fixtures/dev-server/default-config.js --target node' | ||
) | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).not.toContain('client/default/index.js?'); | ||
expect(output.stderr).toContain('foo.js'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it('should prepends the hot runtime to "node" target as well', (done) => { | ||
testBin( | ||
'--config ./test/fixtures/dev-server/default-config.js --target node --hot' | ||
) | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('webpack/hot/dev-server'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it('does not use client.path when default', (done) => { | ||
testBin('--config ./test/fixtures/dev-server/client-default-path-config.js') | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).not.toContain('&path=/ws'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it('should use client.path when custom', (done) => { | ||
testBin('--config ./test/fixtures/dev-server/client-custom-path-config.js') | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('&path=/custom/path'); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
webpack5Test( | ||
'should prepend devServer entry points depending on targetProperties', | ||
(done) => { | ||
testBin('--config ./test/fixtures/dev-server/target-config.js') | ||
.then((output) => { | ||
expect(output.exitCode).toEqual(0); | ||
expect(output.stderr).toContain('client/default/index.js'); | ||
done(); | ||
}) | ||
.catch(done); | ||
} | ||
); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In future we should rewrite these tests on e2e with browser, i.e. run dev server, do some action and wait |
This file contains hidden or 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,3 @@ | ||
'use strict'; | ||
|
||
console.log('I am bar'); |
This file contains hidden or 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,18 @@ | ||
'use strict'; | ||
|
||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
stats: 'detailed', | ||
entry: resolve(__dirname, './foo.js'), | ||
devServer: { | ||
client: { | ||
path: '/custom/path', | ||
}, | ||
transportMode: { | ||
server: 'sockjs', | ||
client: 'sockjs', | ||
}, | ||
}, | ||
}; |
This file contains hidden or 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,18 @@ | ||
'use strict'; | ||
|
||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
stats: 'detailed', | ||
entry: resolve(__dirname, './foo.js'), | ||
devServer: { | ||
client: { | ||
path: '/ws', | ||
}, | ||
transportMode: { | ||
server: 'sockjs', | ||
client: 'sockjs', | ||
}, | ||
}, | ||
}; |
This file contains hidden or 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,18 @@ | ||
'use strict'; | ||
|
||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
stats: 'detailed', | ||
entry: resolve(__dirname, './foo.js'), | ||
devServer: { | ||
client: { | ||
path: '/custom/path', | ||
}, | ||
transportMode: { | ||
server: 'sockjs', | ||
client: 'sockjs', | ||
}, | ||
}, | ||
}; |
This file contains hidden or 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,3 @@ | ||
'use strict'; | ||
|
||
console.log('I am foo'); |
This file contains hidden or 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,19 @@ | ||
'use strict'; | ||
|
||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
stats: 'detailed', | ||
context: __dirname, | ||
entry: { | ||
foo: resolve(__dirname, './foo.js'), | ||
bar: resolve(__dirname, './bar.js'), | ||
}, | ||
devServer: { | ||
transportMode: { | ||
server: 'sockjs', | ||
client: 'sockjs', | ||
}, | ||
}, | ||
}; |
This file contains hidden or 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,24 @@ | ||
'use strict'; | ||
|
||
const { resolve } = require('path'); | ||
|
||
module.exports = { | ||
mode: 'development', | ||
stats: 'detailed', | ||
entry: resolve(__dirname, './foo.js'), | ||
target: ['web', 'webworker'], | ||
output: { | ||
chunkLoading: false, | ||
wasmLoading: false, | ||
workerChunkLoading: false, | ||
}, | ||
devServer: { | ||
client: { | ||
path: '/custom/path', | ||
}, | ||
transportMode: { | ||
server: 'sockjs', | ||
client: 'sockjs', | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.