-
Notifications
You must be signed in to change notification settings - Fork 222
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
Syntax error when using webpack 5 and karma 6 #507
Comments
Related issue: #505 |
This is a much smaller repro, I'll try and look at this sometime over the weekend to troubleshoot. |
Looks like I was mistaken about the workaround unfortunately... |
As mentioned in the other issue, deleting the "browserslist" file solves the problem. I tried a some different approaches to overriding this in my karma config, but was not able to do so successfully. I tried this:
|
Actually, I was able to get it working by putting this in my karma.conf.js:
|
Btw, part of the problem is probably that we use "split bundling" currently, to serve a modern bundle to those who are worthy :) Contents of "browserlist" file:
|
Opened an issue over here to bring attention to this |
I'm working on the same project as @einarq , and can it definitely looks to be something with the way our browserslist is defined. If we remove the environments from our browserslist and f.ex change the browserslist to either:
or
the tests runs fine. Another option is to leave the browserslist as-is with both environments defined, and instead set the |
I am getting the same |
@einarq In this issue, you describe working with karma 6. However, in the linked "example" repo you are using karma 5. Do you have an example "karma 6" repo? |
@peaceful-james
@haakemon Isn't that correct? |
@einarq What does your |
We have a file called simply "browserslist" (not a dot file, no extension),
and it looks like this:
[modern]
last 3 Chrome versions
not Chrome < 60
last 3 Firefox versions
not Firefox < 54
[legacy]
last 5 Chrome versions
last 5 Firefox versions
last 5 Edge versions
Safari >= 10
iOS >= 10.1
IE >= 11
…On Wed, Aug 25, 2021 at 9:59 AM Peaceful James ***@***.***> wrote:
target: 'browserslist:modern',
What does your .browserslistrc file look like?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#507 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABT6DZ27XVBNPIJKN7WEALT6SPGZANCNFSM42UNNVNA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
@einarq Thanks. I will try that. The EDIT: Never mind, I see it's a webpack option. Sadly, with your exact
|
It's a webpack option, so we put it on the weppack part of the
karma.conf.js file:
webpack: {
mode: 'development',
output: {
publicPath: '/',
},
cache: true,
target: 'browserslist:modern',
…On Wed, Aug 25, 2021 at 10:20 AM Peaceful James ***@***.***> wrote:
@einarq <https://github.com/einarq> Thanks. I will try that. The target:
'browserslist:modern', that you put in karma.conf.js, is that a root
level config option? I can't find it in the docs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#507 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABT6D2LDOPIH5ZD3HSZYMLT6SRUTANCNFSM42UNNVNA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>
.
|
I have done some more investigation and I think my problem is actually different in nature to the OP. I have a lib called
This is strange to me because the source on github (https://github.com/facebook/draft-js/blob/10ca1ad44843e970c4314f85a8f37d26f842ebf9/src/component/handlers/edit/commands/moveSelectionBackward.js#L27) just says:
So my I get the syntax error on how this line is interpreted. In
So the I'm sorry if I have cluttered this issue with something unrelated but for posterity I'm leaving my discoveries. |
Final note: I should not have written anything in this issue. My problem was caused by
in my webpack "plugins" config. Sorry for all the noise 🎺 |
@peaceful-james I appreciate your diligence in reporting your findings, those posts may someday be useful to someone troubleshooting the same issue 😉 |
Apologies if this isn't the correct place to report this, but getting a bit desparate. I've converted my app to work with webpack 5, but I'm unable to get the tests running. All configs look correct. I've also tried more or less plugging in the example config from here, but still getting the same error:
https://github.com/appzuka/karma-webpackv5-test
Getting a strong feeling that something related to webpack or karma is completely off, but I'm unable to figure out what it is.
As described below, the weird message I get no matter what I do is this:
I've pasted the beginning of that generated file below.
Expected Behavior
Tests should run fine
Actual Behavior
08 04 2021 20:38:17.964:INFO [karma-server]: Karma v6.3.2 server started at http://localhost:9999/
08 04 2021 20:38:17.965:INFO [launcher]: Launching browsers ChromeNoSandbox with concurrency unlimited
08 04 2021 20:38:17.971:INFO [launcher]: Starting browser Chrome
08 04 2021 20:38:20.213:INFO [Chrome 89.0.4389.114 (Windows 10)]: Connected on socket Arz-bQzd3v3C9CF0AAAB with id 68760601
Chrome 89.0.4389.114 (Windows 10) ERROR
Uncaught SyntaxError: Unexpected token ':'
at C:/Users/einarq/AppData/Local/Temp/_karma_webpack_1/commons.js:3:66
SyntaxError: Unexpected token ':'
Code
Geneated file contents:
The text was updated successfully, but these errors were encountered: