[resolved] the problem that custom directories cannot be copied in vue-cli3 custom preset

Business background

  • vue-cli3 some of the official predefined templates cannot meet their needs
  • for example, I have common tool libraries, sass styles, and generic ui components that need to be built into templates
  • so configure preset yourself.

problems encountered

  • the official document says that the render function in generator.js can generate the specified file into the project
  • but I wrote
  • with reference to the official example
  • the final generated project does not contain some of my preset files
  • that is, none of the files under the template directory have been copied

the following is the project file

t/preset.json
{
  "plugins": {}
}
t/generator.js
module.exports = api => {
  console.log(123123123123);
  api.render("./template");
};
t/template
- src
  - layouts
    - test.js
  - test.js
- test.js

troubleshooting

  • there is an output of 123123123123 at the terminal, indicating that generator is executed
Jun.13,2022

empty folders and empty files will not be render in the past

.
  • all the test.js I created are empty files
  • so it was not compiled.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30966-2bd41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30966-2bd41.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?