laravel-mix / laravel-mix

The power of webpack, distilled for the rest of us.
MIT License
5.27k stars 808 forks source link

ERROR in parent.eval is not a function #3113

Closed Darkproduct closed 3 years ago

Darkproduct commented 3 years ago

Description:

I'm trying to get TypeScript support on an existing Vue project. I would like to update gradually, keeping all the JavaScript code in place and using TypeScript for everything new or where there is a need for refactoring. Currently, I'm stuck on a strange problem. Running with npm run hot:

$ npm run hot

> hot
> mix watch --hot

i Compiling Mix
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

// Some more warning from vuetify. They are not important right now.

√ Mix: Compiled with some errors in 7.29s
ERROR in parent.eval is not a function
Occurred while linting C:\fakepath\ts-test\resources\js\app.ts:7

webpack compiled with 1 error
No issues found.

Unfortunately, I can't find anything regarding this error ERROR in parent.eval is not a function.

Even weirder is, that every time I re-write the tsconfig.json it works fine:

i Compiling Mix

   Laravel Mix v6.0.31

✔ Compiled Successfully in 201ms
┌───────────────────────────────────┬───────────┐
│                              File │ Size      │
├───────────────────────────────────┼───────────┤
│                    /some/files.js │  X.X KiB  │
└───────────────────────────────────┴───────────┘
√ Mix: Compiled successfully in 252.23ms
webpack compiled successfully
Issues checking in progress...
No issues found.

Because this issue involves way too many config files, to reasonably post here, I created a small GitHub project:

https://github.com/Darkproduct/vue2-ts-test

The files to look at, are probably:

Steps To Reproduce:

  1. Clone https://github.com/Darkproduct/vue2-ts-test
  2. Run npm install
  3. Run npm run hot
  4. There should be the error I described first
  5. Open tsconfig.json on some editor and save it again
  6. This should trigger a recompile
  7. Now everything looks fine
  8. Rewrite any other file
  9. The error is back again

StackOverflow Question

I asked this question on StackOverflow a few days ago, but so far no one had any idea. So I figured I ask here, because you guys should know best.

Darkproduct commented 3 years ago

Update

This configuration works fine, if you remove the ESLintPlugin from webpack.mix.js. The question now is: Where does it go wrong and why?

Or at least it translates fine to a usable application. Type hints are still ignored and there is no error whatsoever.

If someone finds this and has good additions to for the sample project, then please create a new issue there.