jarslab/babel-maven-plugin

Error when trying to use typescript preset

Closed this issue · 3 comments

I tried to use the plugin with the typescript preset, and got the following error:

Error: 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.

I was invoking the plugin as follows:

<plugin>
  <groupId>com.jarslab.maven</groupId>
  <artifactId>babel-maven-plugin</artifactId>
  <version>1.5</version>
  <executions>
    <execution>
        <id>js-transpile</id>
        <phase>process-resources</phase>
        <goals>
            <goal>babel</goal>
        </goals>
        <configuration>
            <verbose>true</verbose>
            <threads>4</threads>
            <babelSrc>${project.basedir}/babel/babel.js</babelSrc>
            <sourceDir>${project.basedir}/src/main/typescript/</sourceDir>
            <targetDir>${project.basedir}/target/classes/webapp/</targetDir>
            <jsSourceIncludes>
                <jsSourceInclude>*.js</jsSourceInclude>
                <jsSourceInclude>*.ts</jsSourceInclude>
            </jsSourceIncludes>
            <presets>typescript</presets>
        </configuration>
    </execution>
  </executions>
  
</plugin>

Thank you for PR, great catch! I'll fix one more thing and release new version.

version 1.6 with your change is available at the central, could you take a look and confirm it works for you? Thanks!

Yes, it works fine now! Thanks.