Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ES6 importable version to dist #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rjcortese
Copy link

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Wanted to be able to use this project by importing an ES6 module like:
import { NoSleep } from './nosleep.js';

This does just that. A user can copy the two files in dist/ES6 and then import in another module.

Breaking Changes

Additional Info

No breaking changes as it is... but it isn't integrated well with other parts of the package... basically have two versions of src. There has gotta be a better way... could use some input from the maintainer as to how to structure it.
Might also be what #84 looks to fix.

@richtr
Copy link
Owner

richtr commented Mar 19, 2021

Does the following not work for you?

import NoSleep from 'nosleep.js'

I’m not sure what the specific use case is to import this from a relative path.

@rjcortese
Copy link
Author

It did not work for me. I believe all of that involves using Node runtime or a bundler or other module systems.
See the note in this section: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules#importing_features_into_your_script

I'm just wanting to use the ES6 browser based import mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants