-
Notifications
You must be signed in to change notification settings - Fork 71
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
breaks when used in webpack <=3, with svelte v3 #89
Comments
Corresponding PR : #90 |
Summed up explanation :
I can push the code of the minimal test-case project I used, if needed. |
Is @esarbanis do you remember why you added |
@mrkishi thanks for the precision ! I confess I lacked some energy to dig on the evolution of the API on webpack side. I will do some tests on my minimal test-case. I just hope we won't hit some edge case, trying to get rid of |
Some links to webpack loader apis :
I still don't know why
I'll make some tests and push changes on my PR today (which should be muuuuch cleaner :) ). Thanks ! |
@mrkishi , @esarbanis : I did some analysis again. tldr: removing
New test in PR soon. |
@mrkishi @esarbanis @Rich-Harris @ekhaled @Conduitry CI is green, everything seems OK. Can you check #90 ? |
Released 2.13.4 with the fix — thanks |
Sorry for the annoying issue :-/
TLDR :
It's a cross bug between :
this.options
andloader-utils.getOptions(this)
to handle options.**
this.options
was deprecated in webpack3 and removed in webpack4.**
loader-utils.getOptions(this)
is the right way to do. It appeared in version 1.0.0 (21 Feb 2017) of loader-utils and seems supported since webpack v1edit: proposed pull request : #90
edit: related issue : #88
edit: possibly related issue/pr : #87
Below, all the analysis I did investigating the issue. Sorry, it's a bit verbose.
Context :
Our big project is stuck to webpack 3 at the moment (due to a bug in webpack 4 that will be resolved in webpack 5).
This loader seems to break in webpack3. We have been able to reconstruct a minimal case (using the svelte-app template and making a dichotomy with webpack3 vs webpack4)
let { js, css, warnings } = normalize(compile(processed.toString(), compileOptions));
The kind of errors we have :
On our other project, it's not
entry
butcontext
.After further analysis, it seems that the svelte V3 compiler doesn't like the configuration feeded to it when it comes from webpack 3. The
validate_options()
function of the compiler reject it.Config is inited here :
svelte-loader/index.js
Line 109 in b11b4e9
this.options
is :undefined
(because it was finally deprecated)Config is transformed along the way (into a compileOptions object) and, after that, it's used here :
svelte-loader/index.js
Line 146 in b11b4e9
In the minimal test case we have :
compileOptions with webpack 3 and svelte 3
compileOptions with webpack 4 and svelte 3
The text was updated successfully, but these errors were encountered: