R
R
Ruslan Samara2020-05-20 14:58:05
Frontend
Ruslan Samara, 2020-05-20 14:58:05

Why is there an error when building webpack?

When building (npm run build) with .babelrc config

{
  "presets": [
    //["env", { "modules": false }],
    "stage-3"
  ],
  "plugins": ["transform-async-to-generator"]
}

an error occurs, and if you uncomment ["env", { "modules": false }], the assembly will be assembled, BUT then
when the application is running on vue, when you click on the button, which triggers the asynchronous function, an error occurs in the console:
ReferenceError: regeneratorRuntime is not defined
    at a.sendRouter (Index.vue:221)
    at at (vue.esm.js:1863)
    at HTMLButtonElement.n (vue.esm.js:2188)
    at HTMLButtonElement.i._wrapper (vue.esm.js:7565)

Tell me how to configure babel correctly so that there are no such errors, so that asynchronous requests work and build in production does not interfere.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dmitry-toster, 2020-05-22
@dmitry-toster

Leave the line uncommented and install babel/polyfill
npm install --save @babel/polyfill

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question