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

Bare Imports #3366

Closed
mattpilott opened this issue Aug 13, 2020 · 14 comments
Closed

Bare Imports #3366

mattpilott opened this issue Aug 13, 2020 · 14 comments
Labels
stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed

Comments

@mattpilott
Copy link

I have run into an issue when importing dashjs, using it as a regular script tag works but as an npm module it does not. I have made a repro linked below which exhibits the issue.

Steps to reproduce

https://github.com/matt3224/sapper-dash

Observed behaviour

When importing dash like import dashjs from "dashjs" i get the following issue:

Module specifier, 'stream' does not start with "/", "./", or "../". 
Console output
'stream' is imported by node_modules/sax/lib/sax.js, but could not be resolved – treating it as an external dependency
'string_decoder' is imported by node_modules/sax/lib/sax.js, but could not be resolved – treating it as an external dependency
'stream' is imported by stream?commonjs-external, but could not be resolved – treating it as an external dependency
'string_decoder' is imported by string_decoder?commonjs-external, but could not be resolved – treating it as an external dependency

Thanks!!

@mattpilott
Copy link
Author

Related article http://dplatz.de/blog/2019/es6-bare-imports.html

@bbert
Copy link
Contributor

bbert commented Aug 14, 2020

Have you tried this?:

import * as dashjs from 'dashjs'

@mattpilott
Copy link
Author

@bbert this yields the same result unfortunately

@heff
Copy link
Member

heff commented Aug 30, 2020

Same issue here while trying to use Rollup to compile my app with dashjs. Found the related sax.js issue.

I tried some of the suggestions of requiring stream manually with no luck. I think they may need to happen at the dashjs level before packaging.

@stale
Copy link

stale bot commented Feb 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Feb 26, 2021
@stale
Copy link

stale bot commented Mar 5, 2021

This issue has been automatically closed because no further activity occurred. If you think this issue is still relevant please reopen it. Thank you for your contributions.

@stale stale bot closed this as completed Mar 5, 2021
@dsilhavy dsilhavy reopened this Mar 23, 2021
@stale stale bot removed the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Mar 23, 2021
@stale
Copy link

stale bot commented Aug 20, 2021

This issue has been automatically marked as stale because it has not had recent activity. However, it might still be relevant so please leave a short comment if it should remain open. Otherwise the issue will be closed automatically after two weeks. Thank you for your contributions.

@stale stale bot added the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Aug 20, 2021
@dsilhavy
Copy link
Collaborator

unstale

@stale stale bot removed the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Aug 20, 2021
@stale
Copy link

stale bot commented Jan 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. However, it might still be relevant so please leave a short comment if it should remain open. Otherwise the issue will be closed automatically after two weeks. Thank you for your contributions.

@stale stale bot added the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Jan 17, 2022
@dsilhavy
Copy link
Collaborator

unstale

@stale stale bot removed the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Jan 19, 2022
@FossPrime
Copy link

Having a similar issue in Vite, you'd ostensibly have the same issue in Deno and php-js.

The main culprit seems to be the sax package... which expects tons of global pollution.

My cringe workaround is to do the following, afterwards bruteforce the global into your code with const dashjs = globalThis.dashjs.MediaPlayer as unknown as any

export default defineConfig({
  resolve: {
    alias: {
      dashjs: path.resolve(
        __dirname,
        './node_modules/dashjs/dist/dash.all.min.js'
      )
    }
  }

@TravisC1
Copy link

I too was having issues with dashjs and vite, thanks rayfoss for the workaround. Would love a proper solution, though 👀

@stale
Copy link

stale bot commented Nov 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. However, it might still be relevant so please leave a short comment if it should remain open. Otherwise the issue will be closed automatically after two weeks. Thank you for your contributions.

@stale stale bot added the stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed label Nov 17, 2022
@stale
Copy link

stale bot commented Dec 2, 2022

This issue has been automatically closed because no further activity occurred. If you think this issue is still relevant please reopen it or contact @dsilhavy. Thank you for your contributions.

@stale stale bot closed this as completed Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale To be used by automatic issue staling and closing to indicate that this issue is about to be closed
Projects
None yet
Development

No branches or pull requests

6 participants