Skip to content
This repository has been archived by the owner on May 1, 2022. It is now read-only.

Commit

Permalink
Add filename to babel config (#61)
Browse files Browse the repository at this point in the history
This allows babel plugins to understand what the file's location is when processing it. This actually fixes a bug with babel-plugin-inline-json-import as described in https://github.com/jakedeichert/svelvet/issues/58.

Docs: https://babeljs.io/docs/en/options#filename
  • Loading branch information
jacobdeichert committed Mar 2, 2020
1 parent 2d0e38b commit 3ae4999
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ async function transform(
try {
const source = await fs.readFile(destPath, 'utf8');

let transformed = (await babel.transformAsync(
source,
BABEL_CONFIG
)) as babel.BabelFileResult;
let transformed = (await babel.transformAsync(source, {
...BABEL_CONFIG,
filename: destPath,
})) as babel.BabelFileResult;

if (checkModules) {
const foundMissingWebModule = await checkForNewWebModules(
Expand Down

0 comments on commit 3ae4999

Please sign in to comment.