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

Support ES Modules in release #67

Open
DanielRamosAcosta opened this issue May 25, 2020 · 2 comments
Open

Support ES Modules in release #67

DanielRamosAcosta opened this issue May 25, 2020 · 2 comments

Comments

@DanielRamosAcosta
Copy link

  • Can you try to phrase it as a task?
    Support ES Modules in release

  • Can you make a screenshot or a screencast?
    With the usage of new build tools like vite, it throws the following error:

    vite v0.16.6
    [vite] The following dependencies seem to be CommonJS modules that
    do not provide ESM-friendly file formats:
    
      @pnext/three-loader
    
    - If you are not using them in browser code, you can move them
    to devDependencies or exclude them from this check by adding
    them to optimizeDeps.exclude in vue.config.js.
    
    - If you do intend to use them in the browser, you can try adding
    them to optimizeDeps.commonJSWhitelist in vue.config.js but they
    may fail to bundle or work properly. Consider choosing more modern
    alternatives that provide ES module build formts.
    
  • Is all information accessible for us?
    I think so. The way to solve this would be building an ESM version and release it in the same package. You could check how is it done with rxjs

I can PR if you want! 😄

@DanielRamosAcosta
Copy link
Author

Related to #15

@midnight-dev
Copy link

midnight-dev commented May 26, 2020

Since the majority of the platform is TypeScript, it wouldn't be compatible with ES modules out of the box - not unless I've missed some major developments in TS. However, I'm sure you could configure the compiler / webpack to give you small ES modules. I'd like to see a PR for that if you already have something that works, @DanielRamosAcosta 👍

Edit: Ah, after giving this another look, I believe you mean compiling to a module form instead of many pure JS modules that don't require compiling. In which case, my branch probably isn't want you were looking for. Scratch that.

If your objective is to have Potree features in ES modules for tree-shaking or rapid dev work that wouldn't require compilation, I might have something for you. I transformed one of my local Potree branches into pure modules that load directly in Firefox and Chrome. There are several circular dependency issues I would've liked to iron out, but I may not have time. If this would be of any use to you (as it's pure Potree, not pnext), then I can push that special branch to my fork.

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