Solved when using html2canvas times imported as 'html2canvas') was not found

When the vue project was running (it was fine before), it suddenly reported that imported as 'html2canvas') was not found. I found some information on the Internet, and went to the babel official website to look through it, and finally solved this problem.

1. First download the dependency package @babel/plugin-syntax-dynamic-import

npm install --save-dev @babel/plugin-syntax-dynamic-import

2. Modify the .babelrc file

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "modules": false
      }
    ]
  ],
  "plugins": [
    "@babel/plugin-syntax-dynamic-import"
  ]
}

Guess you like

Origin blog.csdn.net/tq1711/article/details/123105384