help: Error: [BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is called directly,

See original GitHub issue

📚 What are you trying to do? Please describe. I have a Nuxt 2.13.3 app and I would like to use nuxt/composition-api, but when i’m trying to build the app, it failed on the following error:

ERROR in ./.nuxt/client.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is called directly,

babel.transform(code, { filename: ‘file.ts’, presets: [/* your preset */] });

See https://babeljs.io/docs/en/options#filename for more information. (While processing: "/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/nuxt-composition-api/lib/babel.js")
    at validateIfOptionNeedsFilename (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/full.js:274:11)
    at /Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/full.js:286:52
    at Array.forEach (<anonymous>)
    at validatePreset (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/full.js:286:25)
    at loadPresetDescriptor (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/full.js:293:3)
    at loadPresetDescriptor.next (<anonymous>)
    at recurseDescriptors (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/full.js:107:30)
    at recurseDescriptors.next (<anonymous>)
    at loadFullConfig (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/full.js:142:6)
    at loadFullConfig.next (<anonymous>)
    at Function.<anonymous> (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/index.js:33:43)
    at Generator.next (<anonymous>)
    at evaluateSync (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/gensync/index.js:244:28)
    at Function.sync (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/gensync/index.js:84:14)
    at /Users/jankaderabek/xxx/yyy/apps/admin/node_modules/@babel/core/lib/config/index.js:43:61
    at ssrRefPlugin (/Users/jankaderabek/xxx/yyy/apps/admin/node_modules/nuxt-composition-api/lib/babel.js:9:39)
 @ multi ./.nuxt/client.js app[0]

buildModules:

  buildModules: [
    '@nuxt/typescript-build',
    'nuxt-composition-api',
  ],

Do you have any tips how to solve this problem?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
treebeecommented, Apr 23, 2021

Had the same issue, in my case it was a babel.config.js I created for Jest + TypeScript like documented here

I resolved it by rewriting babel.config.js, see Making your Babel config jest-aware of the Jest docs

Hope this helps in case anyone else stumbles over this.

0reactions
avarvouzoucommented, Mar 18, 2022

any updates? I have exactly the same probelm @dncdrn @jankaderabek

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BABEL] unknown: Preset /* your preset */ requires a filename ...
Hello, I've been getting this error in my React Native project Code: ... [BABEL] unknown: Preset /* your preset */ requires a filename...
Read more >
Tests fail to run on React Native - Stack Overflow
[BABEL] unknown: Preset /* your preset / requires a filename to be set when babel is called directly, babel.transform(code, { filename: ...
Read more >
Options - Babel
Primary options; Config Loading options; Plugin and Preset configuration ... filename is unknown, because a subset of options rely on the filename for...
Read more >
Hi Jan. Thanks for this article! | by Ofer Morag - Medium
[BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is called directly,. ``` babel.transform(code ...
Read more >
fable-compiler/Fable - Gitter
... fable: Error transforming Babel AST Error: [BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found