Vue-material: [core] regeneratorRuntime is not defined

Created on 20 Nov 2017  路  24Comments  路  Source: vuematerial/vue-material

I poorly just don't get this to run.

Steps to reproduce

As soon as I import -
import { MdApp } from 'vue-material/dist/components'
import 'vue-material/dist/vue-material.min.css'
Vue.use(MdApp)

to my project, I get:

index.js:1 Uncaught ReferenceError: regeneratorRuntime is not defined at index.js:1 at Object../node_modules/vue-material/dist/components/index.js.Object.defineProperty.value (index.js:1)

I am working with JeffreyWay/laravel-mix
let mix = require('laravel-mix'); mix.js('resources/assets/spa/main.js','public/js/app')

Happens also if i try to import the whole bundle or other components.

bug in review

Most helpful comment

@RichardJECooke After PR will be merged it should work like is written in docs, now you need to use

import VueMaterial from 'vue-material';
import 'vue-material/dist/vue-material.min.css';
Vue.use(VueMaterial);

All 24 comments

same issue here, just try to set up vue-material in my plain new project but this annoy me, no way to figure out.

Looks like its because you doesnt have await/async: https://stackoverflow.com/a/33527883

@Samuell1 - Thanks! This actually was the solution...

That is now my package.json:
"devDependencies": {
"axios": "^0.17",
"babel-core": "^6.0.20",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.0.16",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-3": "^6.24.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.1.10"
},
"dependencies": {
"babel-runtime": "^6.26.0"
}

my .babelrc:
"presets": [ "env", "stage-3" ],
"plugins": [
["transform-runtime", {
"polyfill": false,
"regenerator": true
}]
]

and on the top of my index.js i added:
import "babel-core/register"
import 'babel-polyfill'

This is quite strange. I will take a deep look. The babel stuff should be built in Vue Material.

Maybe the transform-async-to-generator transform could be an alternative to using babel-polyfill:
https://babeljs.io/docs/plugins/transform-async-to-generator/
It requires much less code. babel-polyfill adds around 60kB to your project.

yes, but babel-polyfill adds support for all things not only 1 @marsvin

Whats the status of this issue? Shouldnt Vue Material work without external polyfills? or else the getting started has to be updated?

Got this error on md-input

image

I get the same error in my typescript+webpack project when importing individual components:

ReferenceError: Can't find variable: regeneratorRuntime

import { MdLayout, MdCard} from 'vue-material/dist/components';
import 'vue-material/dist/vue-material.min.css';
Vue.use(MdLayout);
Vue.use(MdCard);

But not when importing the whole module:

import VueMaterial from 'vue-material';
import 'vue-material/dist/vue-material.min.css';
Vue.use(VueMaterial);

and using the exact same template with just some simple layout components.

Same issue here:

const components = {
    "md-snackbar": require('vue-material/dist/components/MdSnackbar')
};

Any chance to get the PR merged soon?
Thanks.

Hi, I'm new to Vue, just tried to follow the 'getting started' documentation and got this error. Which I see is closed. How do you fix it please?

@RichardJECooke After PR will be merged it should work like is written in docs, now you need to use

import VueMaterial from 'vue-material';
import 'vue-material/dist/vue-material.min.css';
Vue.use(VueMaterial);

Just installed and I got the same exact situation as @Huupke.

@Samuell1 Would be possible to import individual components?

That would be awesome @FrancescoMussi ; import a whole css file when you only use some components doesn't make too much sense...

Agreed @FrancescoMussi @ZiFFeL1992 , that would be incredibly useful, especially for older projects migrating to vuematerial.

In my case I need to import full VueMaterial. Importing single componetns generates this error

This issue should be fixed in dev branch.

@Samuell1 is it available already as npm package?

No, its only in dev branch @michjk

@Samuell1 Any update on this? When will it be released?

The same for me, importing components throws a "regeneratorRuntime is not defined" error, but importing full VueMaterial is ok.

I'm having the same issue as @asmi77
It's april 21 already and no solution has been applied?

@jordigoyanes @highco issue is solved in DEV branch like i said in comments before, we waiting to release new version from @marcosmoura that will fix this issue.

New release is out and this should be fixed with it! If you anything find feel free to ping me here :)

https://github.com/vuematerial/vue-material/releases/tag/v1.0.0-beta-10

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreujuanc picture andreujuanc  路  3Comments

korylprince picture korylprince  路  3Comments

lovepluskaka picture lovepluskaka  路  3Comments

capttrousers picture capttrousers  路  3Comments

delueg picture delueg  路  3Comments