Materialize: Uncaught ReferenceError: M is not defined [1.0.0-alpha3]

Created on 2 Jan 2018  路  5Comments  路  Source: Dogfalo/materialize

I have included only

<script src="<?php echo get_stylesheet_directory_uri() . '/js/anime.min.js';?>"></script>
<script src="<?php echo get_stylesheet_directory_uri() . '/js/cash.js';?>"></script>
<script src="<?php echo get_stylesheet_directory_uri() . '/js/collapsible.js';?>"></script>

In my pages, as I don't want all the components of Materialize for this website.

Notes in anime.min.js say that M was removed, however, I get the error message

Uncaught ReferenceError: M is not defined
    at anime.min.js:11
    at anime.min.js:11
collapsible.js:267 Uncaught ReferenceError: anime is not defined
    at collapsible.js:267

Is this my own misunderstanding, or an error?

Most helpful comment

I know this was closed. But I'm using 1.0.0-beta and seeing the same error after I added Sidenav to my page.

The only difference is I imported the full js via webpack.

Please advise in how to get rid of this error. It's preventing my Sidenav from working.

All 5 comments

You cannot use individual files alone. Currently there is no way to import partial components.

Oh. Well, darn. I assumed that was the point of breaking up the plugins into different pieces. I should just be able to use materialize.js with that to make it work though, correct?

Yes

I know this was closed. But I'm using 1.0.0-beta and seeing the same error after I added Sidenav to my page.

The only difference is I imported the full js via webpack.

Please advise in how to get rid of this error. It's preventing my Sidenav from working.

oh, why this nice framework miss the great feature - importing selected modules .. ?

Was this page helpful?
0 / 5 - 0 ratings