Skip to content

Commit

Permalink
polish error message
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Sep 5, 2019
1 parent 0b90ef2 commit 4597db5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/babel-core/src/config/full.js
Expand Up @@ -289,10 +289,9 @@ const validateIfOptionNeedsFilename = (
: "/* your preset */";
throw new Error(
[
`Preset ${formattedPresetName} requires a filename be set.`,
`For example, if you are calling Babel directly`,
`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,
`\`\`\``,
`babel.transform(code, { filename: 'file.js', presets: [${formattedPresetName}] });`,
`babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,
`\`\`\``,
`See https://babeljs.io/docs/en/options#filename for more information.`,
].join("\n"),
Expand Down

0 comments on commit 4597db5

Please sign in to comment.