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

Error: Webpack Compilation Error ./node_modules/@faker-js/faker/dist/esm/chunk-4J2PVEV7.mjs 1:1430 #1073

Closed
foreverchaos opened this issue Jun 15, 2022 · 15 comments · Fixed by #1085
Labels
c: bug Something isn't working s: awaiting more info Additional information are requested

Comments

@foreverchaos
Copy link

Describe the bug

Error: Webpack Compilation Error
./node_modules/@faker-js/faker/dist/esm/chunk-Y64C4BL4.mjs 1:1430
Module parse failed: Unexpected token (1:1430)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

Reproduction

  1. add @faker-js/faker to package.json and npm install
  2. import { faker } from '@faker-js/faker'

Additional Info

version: 7.2.0

@foreverchaos foreverchaos added the s: pending triage Pending Triage label Jun 15, 2022
@import-brain import-brain added c: bug Something isn't working and removed s: pending triage Pending Triage labels Jun 15, 2022
@ST-DDT
Copy link
Member

ST-DDT commented Jun 15, 2022

Which version of node are you using?

@Shinigami92
Copy link
Member

And which version of webpack!

@Shinigami92 Shinigami92 added the s: awaiting more info Additional information are requested label Jun 15, 2022
@MitosisByProxy
Copy link

Have the same issue when using it in a cypress project.

My project dependencies:

"@types/node": "^17.0.42",
"cypress": "^10.1.0",
"cypress-file-upload": "^5.0.3",
"cypress-wait-until": "^1.7.2",
"mochawesome": "^7.1.3",
"npm-run-all": "^4.1.5",
"typescript": "^4.7.3"

Version 10.1.0 of cypress seems to user "webpack": "^4.44.2". I'm using npm 6.14.5 and node v12.18.1.

Can't speak for @foreverchaos but the issue seems the same. Hope it helps.

@Shinigami92
Copy link
Member

and node v12.18.1

Since v7 we officially dropped node v12 support, and require at least node v14

@Samyssmile
Copy link

Samyssmile commented Jun 15, 2022

I have same issue using faker js with cypress in my angular project.

  • Angular 13
  • Cypress 9.7.0
  • faker-js 7.2.0
  • node 16.3.1
    How to reproduce.

npm install --save-dev @faker-js/faker

import {faker} from "@faker-js/faker";

it('signup-signin-logout', function () {
  let username = faker.name.firstName()

}

Error: Webpack Compilation Error
./node_modules/@faker-js/faker/dist/esm/chunk-4J2PVEV7.mjs 1:1430
Module parse failed: Unexpected token (1:1430)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

@agustindangelo
Copy link

Same error on a Cypress project:

Error: Webpack Compilation Error
./node_modules/@faker-js/faker/dist/esm/chunk-4J2PVEV7.mjs 1:1430
Module parse failed: Unexpected token (1:1430)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
  "devDependencies": {
    "@faker-js/faker": "^7.2.0",
    "@wdio/allure-reporter": "^7.19.7",
    "@wdio/cli": "^7.19.7",
    "@wdio/local-runner": "^7.19.7",
    "@wdio/mocha-framework": "^7.19.7",
    "@wdio/spec-reporter": "^7.19.7",
    "chromedriver": "^101.0.0",
    "cypress": "^10.1.0",
    "wdio-chromedriver-service": "^7.3.2"
  },
}
  • node v16.15.0

@danheim
Copy link

danheim commented Jun 16, 2022

Same error node 16, cypress 10

@MitosisByProxy
Copy link

MitosisByProxy commented Jun 16, 2022

and node v12.18.1

Since v7 we officially dropped node v12 support, and require at least node v14

UPDATE:
Moved to node v14.19.3 and the problem persists.

ORIGINAL:
Thx, I'll see if that works when I get back to the office. I do see some comments here that run higher versions of node and still have the same problem.

@Shinigami92
Copy link
Member

Yeah, we are thinking it's not an issue with node14, but totally with incompatible to webpack v4
Webpack doesn't support new syntax
If babel can solve it right now, please use this option as workaround
Currently we do not have the team presence to discuss if we ever want to support webpack v4 again

In my opinion, and please do NOT take that set in stone, but really just my opinion,
I would like to leave webpack v4 behind and support webpack v5 and vite as these are just working

webpack 5.73.0 is the current version and v5 is out for 2 years now
Maybe it's time to move on and a good time to migrate and update your projects... 🤷

@Shinigami92
Copy link
Member

Oh and I definitely need to talk to @JessicaSachs when she is available again... because of Cypress

@Shinigami92
Copy link
Member

#1051 (comment)

@codedevdev
Copy link

Same error node 16 :(
Cypress 10

@JessicaSachs
Copy link
Contributor

JessicaSachs commented Jun 17, 2022 via email

@Shinigami92
Copy link
Member

@foreverchaos @MitosisByProxy @Samyssmile @danheim @agustindangelo @codedevdev

Please checkout the newest version https://github.com/faker-js/faker/releases/tag/v7.3.0

@MitosisByProxy
Copy link

@foreverchaos @MitosisByProxy @Samyssmile @danheim @agustindangelo @codedevdev

Please checkout the newest version https://github.com/faker-js/faker/releases/tag/v7.3.0

This resolves the issue! Thanks for the effort!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working s: awaiting more info Additional information are requested
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

10 participants