Document tsconfig File for Plop Usage in TS
See original GitHub issueHow to reproduce
yarn install plop- Create a perfectly valid
plopfile.ts:
import { NodePlopAPI, AddActionConfig } from 'plop';
export default function generator(plop: NodePlopAPI): void {
...
}
yarn run plop
Expected behavior
plop prints a user prompt, generates files
Actual behavior
$ plop
/src/plopfile.ts:1
import { NodePlopAPI, AddActionConfig } from 'plop';
^^^^^^
SyntaxError: Cannot use import statement outside a module
Versions
Node version: 12.3.0 Plop version: 2.5.3
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:29 (16 by maintainers)
Top Results From Across the Web
Learning to Plop
A little tool that saves you time and helps your team build new files with consistency. Generate code when you want, how you...
Read more >TSConfig Reference - Docs on every TSConfig option
"tsc.ts". ] } This is useful when you only have a small number of files and don't need to use a glob to...
Read more >pages/hooks on your code with PlopJS. - DEV Community
The following example is to generate automatically components. If you want to create hook you need to create new folders and files as...
Read more >Boost your coding productivity with Plop: Tutorial - Medium
How to use Plop to generate custom React boilerplate. ... The templates are simply handlebars files (*.hbs) which, at their most basic level ......
Read more >plop-react-ts - npm
Start using plop-react-ts in your project by running `npm i plop-react-ts`. ... useRedux: false, // use Redux files by default.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Renamed to
plopfile.jsand removes TS syntax.I followed all instructions here and also what is in the example FDiskas linked but I keep getting the same error no matter what Even if I run plop via ts-node which should be able to parse ts files I get this same error. My entire monorepo project only has TS packages and no JS at all, unfortunately, plop isn’t there yet to work well with TS and even after tossing a few hours on it, I couldn’t get it to work, so declaring bankruptcy on getting plopfile.ts to work.
☝️ this error keeps being thrown no matter what I’ve added the
"module": "commonjs"config to my tsconfig.json Using latest plop version"plop": "^3.0.5",and also using latest"ts-node": "^10.7.0",🤷
Either way, I just wanted to say that this lib is great regardless so thanks for maintaining it