Skip to content

Commit 4ffd201

Browse files
committed
Add standalone player
1 parent 0194b43 commit 4ffd201

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ script:
1616
- npm run build:lib
1717
- npm run build:demo
1818
- npm run build:dist
19+
- npm run build:standalone
1920
after_success:
2021
- npm run coverage
2122
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && sshpass -e scp -r -o stricthostkeychecking=no demo/* $DEPLOY_DEST

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
"build:lib": "cross-env NODE_ENV=production babel src -d lib --ignore src/demo",
1414
"build:demo": "cross-env NODE_ENV=production webpack --config webpack.demo.babel.js",
1515
"build:dist": "cross-env NODE_ENV=production webpack --config webpack.dist.babel.js",
16+
"build:standalone": "cross-env NODE_ENV=production webpack --config webpack.standalone.babel.js",
1617
"preversion": "npm run lint",
17-
"version": "auto-changelog -p && npm run build:dist && git add CHANGELOG.md dist",
18+
"version": "auto-changelog -p && npm run build:dist && npm run build:standalone && git add CHANGELOG.md dist",
1819
"prepublishOnly": "npm run build:lib && npm run build:dist",
1920
"postpublish": "npm run clean"
2021
},

src/standalone.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react'
2+
import { render } from 'react-dom'
3+
import ReactPlayer from './ReactPlayer'
4+
5+
export default function renderReactPlayer (container, props) {
6+
render(<ReactPlayer {...props} />, container)
7+
}

webpack.standalone.babel.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import path from 'path'
2+
import config, { minifyPlugins } from './webpack.demo.babel'
3+
4+
export default {
5+
...config,
6+
entry: './src/standalone.js',
7+
output: {
8+
path: path.join(__dirname, 'dist'),
9+
filename: 'ReactPlayer.standalone.js',
10+
library: 'renderReactPlayer'
11+
},
12+
module: {
13+
rules: [
14+
{
15+
test: /\.js$/,
16+
loader: 'babel-loader',
17+
options: {
18+
plugins: ['add-module-exports']
19+
}
20+
}
21+
]
22+
},
23+
plugins: minifyPlugins
24+
}

0 commit comments

Comments
 (0)