Skip to content

add unbundled es6 build with jsx file extensions#1537

Merged
cookpete merged 3 commits intocookpete:masterfrom
DouglasDev:bug/viteLazyImport
Feb 3, 2023
Merged

add unbundled es6 build with jsx file extensions#1537
cookpete merged 3 commits intocookpete:masterfrom
DouglasDev:bug/viteLazyImport

Conversation

@DouglasDev
Copy link
Copy Markdown
Contributor

Fixes: #1443

This command copies the src files to a directory called 'es6', excluding the demo directory, and renames 'js' files to 'jsx' files if they use jsx. This can then be imported into a project that uses vite this way:

import ReactPlayer from 'react-player/es6'; 

This should allow lazy imports as well.

Perhaps the readme should be updated? Not sure what exactly to write.

@solidiquis
Copy link
Copy Markdown

Excited to see this merged. Just came across this problem while migrating from webpack to vite.

@wallw-dev
Copy link
Copy Markdown

wallw-dev commented Nov 11, 2022

This is good, but would also like to see a module field in package.json which points to es6/<entry>, and then you should be able to use:

import ReactPlayer from 'react-player'

with rollup or vite.

@OluAgunloye
Copy link
Copy Markdown

OluAgunloye commented Jan 18, 2023

@DouglasDev @solidiquis @wallw-teal Hello! Any idea when this will be merged?

@OluAgunloye
Copy link
Copy Markdown

Fixes: #1443

This command copies the src files to a directory called 'es6', excluding the demo directory, and renames 'js' files to 'jsx' files if they use jsx. This can then be imported into a project that uses vite this way:

import ReactPlayer from 'react-player/es6'; 

This should allow lazy imports as well.

Perhaps the readme should be updated? Not sure what exactly to write.

Write exactly what you just wrote hahaha, this solved my issue on Vite instantly.

@cookpete cookpete merged commit e10640e into cookpete:master Feb 3, 2023
@cookpete
Copy link
Copy Markdown
Owner

cookpete commented Feb 9, 2023

Published in v2.11.1

@cookpete
Copy link
Copy Markdown
Owner

This is good, but would also like to see a module field in package.json which points to es6/<entry>

Note that this was reverted in v2.11.2 because it broke things: #1574

@nemosmithasf
Copy link
Copy Markdown

@cookpete I believe you need to add typescript definitions to the es6 entry

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.

import ReactPlayer from 'react-player/lazy' fails with vite

6 participants