when I using ttsc command to compile the typescript project, shows error:
> yarn tscbuild
yarn run v1.22.17
$ ttsc
/Users/John/source/reddwarf/frontend/js-wheel/node_modules/resolve/lib/sync.js:111
var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
^
Error: Cannot find module 'transformer-module' from '/Users/John/source/reddwarf/frontend/js-wheel'
at Function.resolveSync [as sync] (/Users/John/source/reddwarf/frontend/js-wheel/node_modules/resolve/lib/sync.js:111:15)
at PluginCreator.resolveFactory (/Users/John/source/reddwarf/frontend/js-wheel/node_modules/ttypescript/lib/PluginCreator.js:158:34)
at PluginCreator.createTransformers (/Users/John/source/reddwarf/frontend/js-wheel/node_modules/ttypescript/lib/PluginCreator.js:120:32)
at Object.newEmit [as emit] (/Users/John/source/reddwarf/frontend/js-wheel/node_modules/ttypescript/lib/patchCreateProgram.js:76:52)
at emitFilesAndReportErrors (/Users/John/source/reddwarf/frontend/js-wheel/node_modules/typescript/lib/typescript.js:126134:23)
Am I missing something? I did not found the package named transformer-module
. I have already installed ttypescript from the instructions from here https://www.npmjs.com/package/ttypescript. what should I do to fixed this issue? the transformer-module
was the plugin of ttypescript. it should be installed by ttypescript.
Referring to the examples provided by ttypescript
, and the little information in your question.
I think you have misunderstood how the module works.
The transform
key of the plugins
object in your tsconfig.json
file must be a relative or absolute path to your file. You probably keep the value transform-module
specified on their documentation.
For example:
{
"compilerOptions": {
"target": "es5",
"declaration": true,
"module": "commonjs",
"strict": true,
"outDir": "dist",
"plugins": [
{
"transform": "./src/transformers/transformer.ts" /* this line here */
}
]
},
"include": ["src/**/*", "node_modules/ttypescript/**/*"],
"exclude": ["src/transformers/**/*"]
}
Source: their examples (https://github.com/cevek/ttypescript/blob/master/packages/ttypescript-examples/tsconfig.json)
Otherwise, feel free to give more context such as a minimal reproducible example
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments