Skip to content

[Question] Demo: Shepherd is not defined #3121

Description

@Guilouf

I'm not a power user of js, for the least. But in the the "demo", Shepherd module is imported in a script tag:
index.html

<link rel="stylesheet" href="shepherd.js/dist/css/shepherd.css"/>
<script type="module" src="shepherd.js/dist/shepherd.mjs"></script>
<script src="demoScript.js"></script>

When imported like this, there is an error in the demo script, Shepherd is not defined.

For the example to work, i had to do differently:
index.html

<link rel="stylesheet" href="shepherd.js/dist/css/shepherd.css"/>
<script type="module" src="demoScript.js"></script>

demoScript.js

import Shepherd from "shepherd.js/dist/shepherd.mjs"

const tour = new Shepherd.Tour({
		defaultStepOptions: {
			cancelIcon: {
				enabled: true
			},
			classes: 'class-1 class-2',
			scrollTo: { behavior: 'smooth', block: 'center' }
		}
	});
//........

Question are, what did I miss, and how it is supposed to work with this import:
<script type="module" src="shepherd.js/dist/shepherd.mjs"></script> ?
I think a jsfiddle would be much more didactic than the current demo page.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions