miracle2k / flask-assets

Flask webassets integration.
BSD 2-Clause "Simplified" License
454 stars 100 forks source link

TypeScript: error TS6131: Cannot compile modules using option 'out' unless the '--module' flag is 'amd' or 'system'. #131

Closed ghost closed 4 years ago

ghost commented 7 years ago

I had to dig around but eventually found that I could set this flag like so:

    assets = Environment(app)
    assets.url = app.static_url_path
    assets.config['TYPESCRIPT_CONFIG'] = "--module system --target ES6"

    typescript = Bundle('app.ts', filters='typescript', output='app.js')
    assets.register('js_all', typescript)

Although I've done that, but am still receiving the error.

The full message is:

webassets.exceptions.FilterError: typescript: subprocess had error: stderr=b'',stdout=b"node_modules/@types/jquery/index.d.ts(2957,63): error TS2304: Cannot find name 'Iterable'.\n../../../../tmp/tmp_x10r0i6.ts(1,1): error TS6131: Cannot compile modules using option 'out' unless the '--module' flag is 'amd' or 'system'.\n", returncode=2

I tried to run the command itself in bash:

tsc --module system --target ES6 --outFile test.js proj/static/app.ts

and that seemed to work fine. It seems my flags specified in assets.config are just not being recognized. Testing them on the CLI works, so I don't think I messed up the flags.

Mark083 commented 6 years ago

The same error here

miracle2k commented 4 years ago

Closing because of age. If something like this occurs again, please report in the webassets repository.