-
Notifications
You must be signed in to change notification settings - Fork 220
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
fix(karma-webpack): don't include the os.tmpdir
(output.publicPath
)
#338
fix(karma-webpack): don't include the os.tmpdir
(output.publicPath
)
#338
Conversation
os.tmpdir
in the publicPath
src/karma-webpack.js
Outdated
@@ -69,7 +69,7 @@ function Plugin( | |||
// Must have the common _karma_webpack_ prefix on path here to avoid | |||
// https://github.com/webpack/webpack/issues/645 | |||
webpackOptions.output.path = path.join(os.tmpdir(), '_karma_webpack_', indexPath, '/') | |||
webpackOptions.output.publicPath = path.join(os.tmpdir(), '_karma_webpack_', publicPath, '/') | |||
webpackOptions.output.publicPath = path.join('/_karma_webpack_', publicPath, '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is simply incorrect right (in general)? Resulting in async chunks loading to fail? I'm only an admin here with limited knowledge about the current needs of a karma
setup, so I need to rely on your help here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"That is simply incorrect right (in general)?" What do you mean by that? I believe this has been broken since PR #279 but has flown under the radar since it only breaks assets with strict CORS checking.
Just wanted to add my 2cents here. Since #279 karma-webpack has been broken for myself and colleagues on Windows (Windows was resolving C:/.... into file://C:/ urls and failing for XHR). Was going to create a new issue but saw this PR. Looks like this patch fixes that issue flawlessly too. All tests resume passing with this PR branch. |
I was about to submit a PR, good thing I checked first :-). Would really like to see this merged as soon as possible as this makes this project unusable for Windows users, especially as code splitting is a common practice these days. |
os.tmpdir
in the publicPath
os.tmpdir
in the publicPath
cc @rynclark |
LGTM after conflicts are resolved |
dd20f5e
to
5f6c7af
Compare
os.tmpdir
in the publicPath
os.tmpdir
(options.publicPath
)
65fec5d
to
49bdae1
Compare
49bdae1
to
bac4676
Compare
@rynclark Should be all set. |
@rynclark Tests are failing for me with the latest commit. Looks to be because |
@JayCanuck Yeah I was unsure about using |
At least in local testing, it looks like the |
Theres also the option of |
That's true, yea, though that feels like having the unnecessary |
@pat841 Please leave it as is within this PR. It is a bug introduced by another recent PR and this ideally should to be adressed separately |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pat841 Thx
@michael-ciniawsky Would you like me to create a new PR for the Windows fix based off of this branch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubberstamp LGTM
@pat841 Thx
os.tmpdir
(options.publicPath
)os.tmpdir
(output.publicPath
)
Released in |
I've just tested 4.0.0-rc.2 on Windows; still a problem I'm afraid. It's what we use in ts-loader for our execution test pack. You can see this PR upgrades from 2.0.6 to 4.0.0-rc2 and then experiences issues: Linux is fine; Windows is not. The failing tests all relate to code splitting / dynamic imports. I'll open a new issue to track this and link back. |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
What is the current behavior? (You can also link to an open issue here)
This fixes issue #333 where a worker would fail to load due to a CORS issue. This change does NOT affect the write path for the webpack build, but the public path reflected in something like
<base href="/_karma_webpack/">
.What is the new behavior?
The
os.tmpdir()
is stripped from the webpack's publicPath so that async assets are loaded correctly from a common domain avoiding CORS issues.Does this PR introduce a breaking change?
If this PR contains a breaking change, please describe the following...
Other information: