-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass mimeTypes option to webpack-dev-middleware
`webpack-dev-middleware` exposes an option to set custom mime types via passing a mimeType object, see https://github.com/webpack/webpack-dev-middleware#mimetypes This commit allows the user to set `devServer.mimeType` in `webpack.config.js` to pass custom mimes types to `webpack-dev-middleware`
- Loading branch information
Showing
4 changed files
with
100 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const helper = require('./helper'); | ||
const config = require('./fixtures/simple-config/webpack.config'); | ||
|
||
describe('MimeTypes', () => { | ||
afterEach(helper.close); | ||
|
||
it('remapping mime type without force should throw an error', () => { | ||
expect(() => { | ||
helper.start(config, { | ||
mimeTypes: { 'text/html': ['js'] }, | ||
}); | ||
}).toThrow(/Attempt to change mapping for/); | ||
}); | ||
|
||
it('remapping mime type with force should not throw an error', (done) => { | ||
helper.start( | ||
config, | ||
{ | ||
mimeTypes: { | ||
typeMap: { 'text/html': ['js'] }, | ||
force: true, | ||
}, | ||
}, | ||
done | ||
); | ||
}); | ||
}); |
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