How do I specify a tsconfig.json for assetic's TypeScript filter?

Viewed 590

I'm using Symfony 3.3 and the assetic bundle. I have this in my config.yml:

assetic:
    debug:          '%kernel.debug%'
    use_controller: '%kernel.debug%'
    filters:
        cssrewrite: ~
        typescript: 
            bin: "%kernel.root_dir%/../node_modules/typescript/bin/tsc"
            apply_to: "\\.ts$"

When I try to compile my TypeScript files, I get this error:

Output:
../../../../private/var/folders/94/45yn02792ksfglm12pjxxlp00000gn/T/assetic_typescript_in59bccf08e6357/my-form.ts.ts(6,1): error TS6131: Cannot compile modules using option 'out' unless the '--module' flag is 'amd' or 'system'.
../../../../private/var/folders/94/45yn02792ksfglm12pjxxlp00000gn/T/assetic_typescript_in59bccf08e6357/my-form.ts.ts(6,22): error TS2307: Cannot find module './my-obj.model'.

This occurs after I use an import statements like import { Obj } from './my-obj.model';. If I don't use import statements, ts compilation works fine.

How do I add give assetic's TypeScript filter either a --module system parameter or a tsconfig.json?

2 Answers
Related