Typescript: resolveJsonModule with `--module es2015`

Created on 27 Jul 2018  路  6Comments  路  Source: microsoft/TypeScript

Related Issues

25755, #24588

Examples

I'm using Typescript with rollup with https://github.com/rollup/rollup-plugin-json and with TS 2.9 everything worked fine. TS 3 disables JSON modules with everything other than commonjs modules. Could this be changed for es2015 modules?

Duplicate Fixed

Most helpful comment

--module esnext
I use webpack and I also have this requirement.

All 6 comments

I filed a separate issue (and linked to the original one) since the other issue talks about amd.

--module esnext
I use webpack and I also have this requirement.

Me as well, I just want to TypeScript to load JSON and provide type intelligence to VSCode. That way TypeScript can enforce any code access of JSON object is valid.

@gamedevsam the workaround would be to target CommonJS in the tsconfig.json but whatever your build pipeline/bundler is that handles JSON, to ensure that it emits the TypeScript in the module format you prefer.

This is fixed in master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Roam-Cooper picture Roam-Cooper  路  3Comments

Antony-Jones picture Antony-Jones  路  3Comments

dlaberge picture dlaberge  路  3Comments

weswigham picture weswigham  路  3Comments

wmaurer picture wmaurer  路  3Comments