Skip to content

Commit

Permalink
feat: better webpack support
Browse files Browse the repository at this point in the history
  • Loading branch information
zhensherlock committed May 7, 2023
1 parent b4c60b1 commit 427152d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
7 changes: 7 additions & 0 deletions index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/index.cjs.min.js')
} else {
module.exports = require('./dist/index.cjs.js')
}
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./dist/index.cjs.min.js')
} else {
module.exports = require('./dist/index.cjs.js')
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webrtc-streamer-helper",
"version": "0.0.6",
"version": "0.0.7",
"description": "webrtc streamer helper",
"scripts": {
"clean:dist": "rimraf dist",
Expand All @@ -25,11 +25,26 @@
],
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"browser": "dist/index.browser.js",
"unpkg": "",
"webpack": "dist/index.esm.js",
"browser": "dist/index.esm.js",
"unpkg": "dist/index.iife.js",
"jsdelivr": "dist/index.iife.js",
"types": "dist/types/main.d.ts",
"exports": {
".": {
"types": "./dist/types/src/index.d.ts",
"import": "./dist/index.cjs.js",
"require": "./dist/index.cjs.js"
},
"./package.json": "./package.json",
"./dist/*": "./dist/*"
},
"files": [
"dist"
"dist",
"index.js",
"index.cjs",
"LICENSE",
"README.md"
],
"devDependencies": {
"@rollup/plugin-babel": "^6.0.3",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const output = [
{
name: 'WebrtcStreamerHelper',
format: 'iife',
file: 'dist/index.browser.js',
file: 'dist/index.iife.js',
sourcemap: true
},
{
Expand All @@ -51,7 +51,7 @@ const output = [
{
name: 'WebrtcStreamerHelper',
format: 'iife',
file: 'dist/index.browser.min.js',
file: 'dist/index.iife.min.js',
plugins: [terser()]
},
{
Expand Down

0 comments on commit 427152d

Please sign in to comment.