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

Maybe could remove '#' before module name for common import usage #2

Closed
AdvancedCat opened this issue Mar 3, 2022 · 3 comments
Closed

Comments

@AdvancedCat
Copy link
Contributor

I konw the first character ‘#’ in module name is to declare that module from a inline-module script with id attribute.
But I feel a little awkward when importing module with '#'. In my sense, 'foo' is module, not '#foo', like this:

import { bar } from 'foo'

In case of module conflict, maybe can store two names in importmap, one is 'foo', another is '#foo', unless has other better choices.

@akira-cn
Copy link
Contributor

akira-cn commented Mar 3, 2022

Deprecated

Add prefix attribute to give other choices, prefix is # by default(recommend).

Now you can use:

<script src="https://unpkg.com/inline-module/index.js" setup prefix=""></script>

to remove #.

Or

<script src="https://unpkg.com/inline-module/index.js" setup noprefix></script>

as shortcut.

@AdvancedCat
Copy link
Contributor Author

LGTM

@akira-cn
Copy link
Contributor

akira-cn commented Mar 3, 2022

LGTM

Maybe name attribute is a better way.

Now:

  <script type="inline-module" name="foo" id="bar">
  const foo = 'bar';
  export default foo;
  </script>

Either import foo from 'foo' or import foo from '#bar' is Okey.

@akira-cn akira-cn closed this as completed Mar 3, 2022
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

No branches or pull requests

2 participants