Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Webpack Includes Tests in Production Build #501

Closed
nicwillemse opened this issue Dec 9, 2016 · 8 comments
Closed

Webpack Includes Tests in Production Build #501

nicwillemse opened this issue Dec 9, 2016 · 8 comments

Comments

@nicwillemse
Copy link

In the current setup it looks as if the webpack configuration is including the JS specs as part of the production build.

@SteveSandersonMS
Copy link
Member

Does it really include them? I just tried webpack --env.prod and looked at the resulting wwwroot/dist/main-client.js. Ctrl+F for "karma" and "should" both gave zero results, so it doesn't look like any test code is in there.

If you have repro steps that cause the tests to be included in production build, can you please post them?

@nicwillemse
Copy link
Author

Hi @SteveSandersonMS,

I was referring to the actual tests themselves, since the webpack configuration does not seem to be excluding specs at all ?

@MarkPieszak
Copy link
Contributor

@nicwillemse Do you mean that the webpack configs need the exclude portion for .spec.ts files added in there?

@SteveSandersonMS
Copy link
Member

@nicwillemse Unless I'm missing something, the spec files don't need to be excluded. They won't be bundled with the application code, because the application code doesn't reference the specs.

@nicwillemse
Copy link
Author

@MarkPieszak thats exactly what im saying. @SteveSandersonMS do you agree with this comment ?

@SteveSandersonMS
Copy link
Member

No I don't - please see my previous comment for details :)

@nicwillemse
Copy link
Author

@SteveSandersonMS - im not sure your previous comment applies, the specs will be bundled due to the webpack configuration.

@SteveSandersonMS
Copy link
Member

Can you confirm that you're actually seeing spec code inside the built bundles in wwwroot/dist/?

I searched mine and didn't find any spec code in those bundles, nor would I expect to, since the specs are not referenced from the application code.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants