Skip to content
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

The output.filename should end with .js. #334

Closed
sechel opened this issue Jul 31, 2018 · 4 comments · Fixed by #336 · May be fixed by jeremyrajan/karma-webpack#2
Closed

The output.filename should end with .js. #334

sechel opened this issue Jul 31, 2018 · 4 comments · Fixed by #336 · May be fixed by jeremyrajan/karma-webpack#2

Comments

@sechel
Copy link

sechel commented Jul 31, 2018

There are certain issues with your current config
https://github.com/webpack-contrib/karma-webpack/blob/1ac16eaa7b11ee154a2127d4f03cbfd1a81533f6/src/karma-webpack.js#L65

For instance the folks over at html-webpack-plugin filter all assets that do not end with .js, thus all .html files emitted stay empty when built alongside the test bundle using karma webpack.
Another thing is that webpack-dev-middleware doesn't recognize the mime type, e.g, when using a typescript .ts input file and this leads to other problems in browsers. One could solve this with a simple mime: { 'text/javascript': ['ts'] } but this seems hacky to me.

Anyway, I wanted to drop a line and see if we could get a discussion running on the matters.
Greetings
Stefan

@nanomosfet
Copy link

nanomosfet commented Aug 1, 2018

if webpackOptions is the webpack config that you are loading then you can just append .js to the end of your output webpackOptions.output.filename = '[name]' + '.js'

@sechel
Copy link
Author

sechel commented Aug 1, 2018

Yes but the plugin constructor of karma-webpack overwrites the settings I'm doing in my webpack.config.js or do I miss something here?

@nanomosfet
Copy link

nanomosfet commented Aug 1, 2018

@sechel Could you post your karma and webpack config files?

@jantimon
Copy link

jantimon commented Aug 7, 2018

Imho @sechel is right - karma-webpack/src/karma-webpack.js line 65 has to be changed to output files with a .js extension.

Is there any reason why it does not use an extension here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants